home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / ada / atutr202.zip / print.me < prev    next >
Text File  |  1992-09-04  |  89KB  |  2,235 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.                               Welcome  to
  21.                             A D A - T U T R
  22.                        The Interactive Ada Tutor
  23.                         by John J. Herro, Ph.D.
  24.                     Software Innovations Technology
  25.  
  26.                   These are the printed course notes.
  27.  
  28.                         Ver. 2.02, 4 Sep. 1992
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.                    Copyright 1988-1992 John J. Herro
  46.  
  47.                     Software Innovations Technology
  48.              1083 Mandarin Dr. NE, Palm Bay, FL 32905-4706
  49.                              (407)951-0233
  50.  
  51.  
  52.                   You may make copies of these notes,
  53.                   in printed or machine-readable form.
  54.  
  55.                 You may also copy the computer program.
  56.                      Please see page 1 for details.
  57.  
  58.  
  59.                                                                Page  i
  60.  
  61.                           TABLE OF CONTENTS
  62.  
  63.  
  64. Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   i
  65. Acknowledgments  . . . . . . . . . . . . . . . . . . . . . . . . .  ii
  66. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . .   1
  67. Registration and Licenses - What is Shareware? . . . . . . . . . .   2
  68. Special Offer to Companies, Schools, Etc.  . . . . . . . . . . . .   3
  69. Note to Compiler Companies . . . . . . . . . . . . . . . . . . . .   5
  70. Does Your Screen Show Strange Characters Like Arrows and Brackets?   6
  71. The Ada Reserved Words . . . . . . . . . . . . . . . . . . . . . .   7
  72. Steps for Outside Assignment 1, Preparing to Run Ada . . . . . . .   8
  73. Listings of HELLO.ADA and ADD.ADA  . . . . . . . . . . . . . . . .   9
  74. Listing of TRITEST.ADA . . . . . . . . . . . . . . . . . . . . . .  10
  75. Steps for Outside Assignment 2, Exercise in Enumeration Types  . .  12
  76. Listing of NEXTDATE.ADA  . . . . . . . . . . . . . . . . . . . . .  13
  77. Steps for Outside Assignment 3, Exercise in Records  . . . . . . .  14
  78. Listing of FIBTEST.ADA . . . . . . . . . . . . . . . . . . . . . .  15
  79. Steps for Outside Assignment 4, Exercise in Recursion  . . . . . .  16
  80. Simplified Specification for TEXT_IO . . . . . . . . . . . . . . .  17
  81. Listings of Procedure FILECOPY and Function EXISTS . . . . . . . .  19
  82. Requirements for the Program LEDIT . . . . . . . . . . . . . . . .  20
  83. Steps for Outside Assignment 5, Writing a Simple Line Editor . . .  25
  84. How to Test LEDIT  . . . . . . . . . . . . . . . . . . . . . . . .  26
  85. Listing of LEDIT.ANS . . . . . . . . . . . . . . . . . . . . . . .  29
  86. Listing of TASKING.DUM . . . . . . . . . . . . . . . . . . . . . .  33
  87. Steps for Outside Assignment 6, Exercise in Tasking  . . . . . . .  34
  88. Output from TASKING.EXE After Modification of TASKING.ADA  . . . .  35
  89. Listing of TASKING.ANS . . . . . . . . . . . . . . . . . . . . . .  36
  90.  
  91. Appendix A:  Would You Like a Textbook to Use Along with ADA-TUTR?  37
  92. Appendix B:  Running BOOK to Print All the Screens . . . . . . . .  38
  93. Appendix C:  Some Ada Compilers Available for the PC . . . . . . .  39
  94. Appendix D:  Sample Multi-User Software License  . . . . . . . . .  40
  95. Appendix E:  Do You Need a Screen Editor / Word Processor? . . . .  42
  96. Appendix F:  Installing ADA-TUTR on Other Computers  . . . . . . .  43
  97. Appendix G:  We Listen!  New Features of ADA-TUTR  . . . . . . . .  48
  98. Appendix H:  Disclaimer of Warranty  . . . . . . . . . . . . . . .  50
  99.  
  100.                                                                Page ii
  101.  
  102.                            ACKNOWLEDGMENTS
  103.  
  104. The following trademarks are used in these notes and in the
  105. accompanying files:
  106.  
  107.         FirstAda         Alsys, Inc.
  108.         IBM              International Business Machines Corp.
  109.         IntegrAda        Aetech, Inc.
  110.         Janus/Ada        R R Software, Inc.
  111.         Meridian Ada     Meridian Software Systems, Inc.
  112.         Open Ada         Meridian Software Systems, Inc.
  113.         PC-Write         Quicksoft
  114.         TeleGen          Telesoft Corporation
  115.         Turbo Pascal     Borland International
  116.         UNIX             AT & T
  117.         VAX              Digital Equipment Corporation
  118.         VMS              Digital Equipment Corporation
  119.  
  120. The file ONECHAR.C was sent to us by Mr. David Hill, 7549 Wynford
  121. Street, Salt Lake City, UT 84121, and the file ALTCHAR.C was sent to
  122. us by Mr. Richard Conn, 2700 Bowline Court, Maineville, OH 45039.
  123. We're very grateful to Mr. Hill and to Mr. Conn for giving us
  124. permission to include these files in ADA-TUTR.  When used with
  125. UNIX.ADA, these files provide two ways to run the Tutor on UNIX based
  126. machines without having to strike ENTER after each response.  See
  127. pages 43-47.
  128.  
  129. The programs in this version of ADA-TUTR were compiled with the
  130. Meridian Ada Compiler, v4.1, and optimized with the Meridian IFORM
  131. Optimizer, v1.0.  The .EXE files contain Meridian's runtime, and were
  132. further compressed with the public domain program LZEXE, v0.91, by
  133. Fabrice Bellard of Grabels, France.
  134.  
  135.                                                                Page  1
  136.  
  137.                              INTRODUCTION
  138.  
  139. ADA-TUTR, the Interactive Ada Tutor, will make you an excellent Ada
  140. programmer in minimum time.  You'll learn good Ada program design
  141. techniques, not just Ada syntax.  ADA-TUTR runs on PCs as well as
  142. workstations and mainframes.  On PCs an Ada compiler is helpful, but
  143. not required.  The PC can have a monochrome or a color monitor.
  144.  
  145. These printed notes aren't meant to be a complete course, or even a
  146. summary, of Ada.  They merely accompany the program ADA-TUTR, which is
  147. a complete course.  You can't "study" these printed notes alone.  For
  148. now, just read pages 1, 2, and 6.
  149.  
  150. ADA-TUTR lets you learn at your own pace.  So that you don't feel
  151. pressured, ADA-TUTR doesn't keep track of the number of right and
  152. wrong answers.  It simply tells you whether your answers are correct,
  153. and why.  Also, there's no time limit for answering the questions or
  154. completing the Outside Assignments.
  155.  
  156. Because I want every programmer to have a chance to learn the best
  157. programming language, I made ADA-TUTR available very inexpensively as
  158. Shareware.  Shareware isn't the same as public domain, and ADA-TUTR
  159. isn't free.  But you may TRY it for free, and register or buy a
  160. license only if you use it.  Please see pages 2-3 for details.
  161.  
  162. Whether or not you use ADA-TUTR and register (or buy a license),
  163. you're encouraged to make unmodified copies of the program and
  164. distribute them.  Please put ADA-TUTR on computer bulletin boards,
  165. distribute copies at club meetings, give them to companies, etc.  You
  166. may charge a small fee to copy the program, provided you make it clear
  167. that the fee is only for the copy, and doesn't pay for the Shareware.
  168. (Companies that copy Shareware usually charge about $2 to $10 per
  169. diskette.)  Bulletin boards may carry ADA-TUTR even if they charge for
  170. access.  Please contact us for permission to include ADA-TUTR with
  171. commercial products, such as Ada compilers (see page 5).  You may use
  172. file compression, library, and archive programs on ADA-TUTR; we won't
  173. interpret that as "modifying" the program.  You may also add your own
  174. files.  (The files included with ADA-TUTR are briefly described in
  175. ED.DIR.)  If you register, you can earn substantial money distributing
  176. ADA-TUTR; please see page 2 for details.
  177.  
  178. Ada will become more and more important, since the Department of
  179. Defense mandated its use in defense software, and is now making it
  180. very hard to obtain waivers.  Although learning Ada takes real effort,
  181. you'll be able to write software that's more reliable and easier to
  182. modify a month or a year later.
  183.  
  184. New features of this version of ADA-TUTR are described on pages 48-49.
  185. Please send me your comments and suggestions.  I wish you success
  186. using ADA-TUTR!
  187.  
  188. John J. Herro, Ph.D., Software Innovations Technology
  189. 1083 Mandarin Drive NE, Palm Bay, FL 32905-4706   (407)951-0233
  190.  
  191.                                                                Page  2
  192.  
  193.             REGISTRATION AND LICENSES - WHAT IS SHAREWARE?
  194.  
  195. Shareware is a way of marketing a program.  It lets you try the
  196. program before spending money for it.  If you decide to use the
  197. program, you send a small payment to register your copy or buy a
  198. license.  We give you several incentives to do so, explained below.
  199. You're on your honor; you know whether you're "using" ADA-TUTR or
  200. only "trying" it.
  201.  
  202. To use ADA-TUTR, individuals register as described below.  Companies,
  203. schools, and other organizations can register each individual who
  204. uses the program, or buy a Multi-User License as described on the next
  205. page.
  206.  
  207. INDIVIDUALS:  Register your copy for only $25.  When you register,
  208. please give us the serial number from the ADA-TUTR opening screen.
  209. We'll assign you a new serial number.  Then run CHANGESN to put your
  210. new number into the program, and give copies to individuals, schools,
  211. companies, clubs, computer bulletin boards, etc.
  212.  
  213. We'll send you a commission of $5 for each individual who registers
  214. from one of your copies, and TEN PERCENT for each Multi-User License
  215. sold from one of your copies!  As you can see from the next page, you
  216. can earn up to $240 per license sold!  Commissions are paid quarterly.
  217. If you like, print the file AD.TXT and use copies as an advertisement.
  218.  
  219. Registration includes the right to use ADA-TUTR as long as you like,
  220. and it includes technical support for one year.  While you have
  221. technical support, we'll inform you of any important updates to
  222. ADA-TUTR, and send you updated copies for only $5 each ($10 if you
  223. prefer a 3.5" diskette, free if you send us a blank, formatted,
  224. diskette with a stamped, addressed diskette mailer).  We're planning a
  225. major update of ADA-TUTR with the next revision (9X) of the Ada
  226. language.  You can renew technical support for only $10 a year.  Even
  227. if you don't renew, you'll continue to receive commissions.
  228.  
  229. When you register, you may order a copy of the current version of
  230. ADA-TUTR, with your serial number.  The price is $5 for a 5.25"
  231. diskette, $10 for a 3.5" diskette, or free with your formatted
  232. diskette and a stamped, addressed diskette mailer.  If you would like
  233. an order form or a price list, please print the file INVOICE.TXT.
  234.  
  235. We offer a Customization Kit that lets you edit, add, and delete
  236. ADA-TUTR screens, questions, etc. (even whole topics), producing a new
  237. ADA_TUTR.DAT file.  See the last paragraph on page 4.  Note that the
  238. Customization Kit is not Shareware.
  239.  
  240. We sell anywhere in the Free World.  We're sorry, but we don't yet
  241. accept credit cards.  Outside the U.S., please remit in U.S. funds and
  242. contact us about extra postal charges on diskettes.
  243.  
  244.  
  245. COMPANIES, SCHOOLS, AND OTHER ORGANIZATIONS:  Please see our special
  246. offer for Multi-User Licenses on the next page.
  247.  
  248.                                                                Page  3
  249.  
  250.                SPECIAL OFFER TO COMPANIES, SCHOOLS, ETC.
  251.  
  252. ADA-TUTR can be of great benefit to your company, school, or other
  253. organization.  We encourage you to try ADA-TUTR before paying for it,
  254. and you may install ADA-TUTR on your workstations and mainframes as
  255. well as your PCs!  Instructions for installing ADA-TUTR on other
  256. computers are on page 43.
  257.  
  258. If you decide to use ADA-TUTR, you could register each individual
  259. user, as described on page 2.  But if you have more than 18 users, you
  260. can save money by buying a Multi-User License, as described here.
  261. You're on your honor; you know whether you're "using" ADA-TUTR or only
  262. "trying" it.  Multi-User Licenses are very reasonably priced, as
  263. follows:
  264.  
  265.  Number of Users:  Price of License:               Note:
  266.  
  267.     Up to  100        only  $450      Send $5 extra for a copy of the
  268.     Up to  500        only  $725      latest version of ADA-TUTR on a
  269.     Up to 2000        only  $950      5.25" diskette, $10 extra for a
  270.     Unlimited         only $2400      copy on a 3.5" diskette.
  271.  
  272. A license may always be upgraded for only the difference in price.
  273.  
  274. A sample Multi-User license appears on pages 40-41.  A Multi-User
  275. License gives the specified number of people the right to use ADA-TUTR
  276. as long as you like, on all your computers (from small PCs to large
  277. mainframes), at all your locations.  We use the term Multi-User
  278. License rather than Site License because there are no geographic
  279. restrictions.  (Note: If 100 people use ADA-TUTR now and 100 others
  280. use it later, that counts as 200 users, not 100.)  Sales commissions
  281. are NOT paid to Multi-User Licensees.
  282.  
  283. A Multi-User License includes one year of technical support, which can
  284. be renewed for only 10% of the price of the license per year.  While
  285. you have technical support, we'll inform you of any important updates
  286. to ADA-TUTR, and send you an updated copy on a 5.25" diskette for only
  287. $5 ($10 for a 3.5" diskette).  The update is free if you send your own
  288. blank, formatted diskette and a stamped, addressed diskette mailer.
  289. We're planning a major update of ADA-TUTR with the next revision (9X)
  290. of the Ada language.
  291.  
  292. Even if you don't renew your Technical Support, you'll still have the
  293. right to use ADA-TUTR as long as you like.
  294.  
  295. Please print the file INVOICE.TXT, or use your own form.  (When
  296. ordering, please give us the serial number from the opening screen of
  297. your copy of ADA-TUTR, if you have one.)
  298.  
  299. We accept Purchase Orders.  Our Federal tax ID number is 360-40-8382,
  300. and we qualify as a Small Business.  We sell anywhere in the Free
  301. World.  We're sorry, but we don't yet accept credit cards.  Outside
  302. the U.S., please remit in U.S. funds and contact us about extra postal
  303. charges on diskettes.
  304.  
  305.                                                                Page  4
  306.  
  307. With Shareware, you never have to worry about software piracy, because
  308. your people are ENCOURAGED to copy and distribute the program!  If you
  309. prefer, however, a conventional (non-Shareware) version of ADA-TUTR is
  310. available at the same prices.
  311.  
  312. If you buy a license, we'll be happy to do minor customization of
  313. ADA-TUTR for you at no charge.  For example, we can add your company
  314. name to the opening screen.  If you'd like major customization,
  315. contact us for terms, or buy our Customization Kit for $195.  Using
  316. any text editor on a PC or mainframe, the Customization Kit lets you
  317. edit, add, and delete screens, questions, etc. (even whole topics),
  318. producing a new ADA_TUTR.DAT file.  The Customization Kit isn't
  319. Shareware, but you may copy it for use throughout your organization as
  320. required.
  321.  
  322.                                                                Page  5
  323.  
  324.                       NOTE TO COMPILER COMPANIES
  325.  
  326. A Commercial version of ADA-TUTR is available, without the Shareware
  327. notices and without the list of Ada compilers.  It can be customized
  328. for your company, and can run on almost any Ada platform, including
  329. workstations and mainframes, because Ada source code is included.
  330. ADA-TUTR can greatly increase the sales appeal of your compilers and
  331. your Ada tools, whether you sell it separately or include it with your
  332. products.  Please contact us.
  333.  
  334. If you're a prospective contractor or subcontractor, the Commercial or
  335. Shareware version of ADA-TUTR may be the best and most economical way
  336. for you to supply your customer's Ada educational needs.  Please
  337. contact us before writing your proposal.
  338.  
  339.                                                                Page  6
  340.  
  341.   DOES YOUR SCREEN SHOW STRANGE CHARACTERS LIKE ARROWS AND BRACKETS?
  342.  
  343. Give the command TYPE READ.ME on your PC.  If one word appears
  344. brighter than the rest, you can skip this page.  However, if your
  345. screen shows strange characters like "[1m" when you TYPE READ.ME or
  346. run ADA_TUTR, you need to read this.
  347.  
  348. ADA-TUTR uses ANSI (American National Standards Institute) escape
  349. sequences for highlighting, cursor positioning, reverse video, etc.
  350. Before ADA-TUTR will work correctly on a PC, you must install the
  351. device driver ANSI.SYS, which came with your copy of DOS.  To install
  352. ANSI.SYS, do the following:
  353.  
  354. 1.  If there's a file CONFIG.SYS in the root directory of the disk
  355.     from which you boot, type it and look for a line saying
  356.     "DEVICE=ANSI.SYS" (without the quotes), in either upper or lower
  357.     case.  If that line is not present, add it to CONFIG.SYS anywhere
  358.     in the file, using an ordinary text editor or word processor in
  359.     the non-document mode.  If there's no CONFIG.SYS file, create one
  360.     containing the single line "DEVICE=ANSI.SYS" (without the quotes).
  361.  
  362. 2.  If there's no file ANSI.SYS in your root directory, copy ANSI.SYS
  363.     from your DOS distribution diskette to the root directory of the
  364.     disk from which you boot.
  365.  
  366. 3.  Reboot the computer.  ADA-TUTR should then work correctly.
  367.  
  368.                                                                Page  7
  369.  
  370.                        THE ADA RESERVED WORDS
  371.  
  372. The 63 reserved words are listed in the Language Reference Manual in
  373. section 2.9, and are repeated here for convenience.
  374.  
  375.   abort         declare        generic      of             select
  376.   abs           delay          goto         or             separate
  377.   accept        delta                       others         subtype
  378.   access        digits         if           out
  379.   all           do             in                          task
  380.   and                          is           package        terminate
  381.   array                                     pragma         then
  382.   at            else                        private        type
  383.                 elsif          limited      procedure
  384.                 end            loop
  385.   begin         entry                       raise          use
  386.   body          exception                   range
  387.                 exit           mod          record         when
  388.                                             rem            while
  389.                                new          renames        with
  390.   case          for            not          return
  391.   constant      function       null         reverse        xor
  392.  
  393.                                                                Page  8
  394.  
  395.          STEPS FOR OUTSIDE ASSIGNMENT 1, PREPARING TO RUN ADA
  396.  
  397. For the first Outside Assignment, learn enough about your Ada compiler
  398. to compile and run the two simple programs HELLO.ADA and ADD.ADA.
  399. Obviously, you have to do this before you can do the remaining Outside
  400. Assignments.
  401.  
  402. 1.  Compile HELLO.ADA.  On most systems, after the Ada compiler is
  403. installed and your library is created, this only involves typing
  404. ADA HELLO or ADA HELLO.ADA.  On some systems, the compiler is invoked
  405. from a menu or "APSE" (Ada Programming Support Environment).
  406.  
  407. 2.  Link, giving the name of the main program, HELLO.  This usually
  408. involves typing LINK HELLO or BIND HELLO, perhaps with some options.
  409. On one system, the command is BAMP HELLO, for Build Ada Main Program!
  410.  
  411. 3.  Run the program.  If your Ada compiler produces native code on a
  412. PC, it created a file HELLO.EXE, and this step simply involves typing
  413. HELLO.  On other systems, the command RUN HELLO is appropriate.  On
  414. some systems, you have to invoke an interpreter to run the program.
  415.  
  416. 4.  Now compile, link, and run ADD.ADA.
  417.  
  418. If your compiler implements a subset of Ada, you may have to modify
  419. the programs in this and later Outside Assignments to get them to
  420. compile.  Some subset Ada compilers don't allow "separate" compilation
  421. (used in later assignments), and you'll have to include the "separate"
  422. subprograms inside the main program and compile them as one.  Some
  423. subset compilers don't allow generic instantiation, and have another
  424. way of displaying integers.  In that case, you'll have to modify
  425. ADD.ADA.  If you're using a validated compiler, you won't have to
  426. worry about any of this, because all of the Outside Assignments are
  427. written in standard Ada.
  428.  
  429.                                                                Page  9
  430.  
  431. HELLO.ADA
  432. ---------
  433.  
  434. with TEXT_IO; use TEXT_IO;
  435. procedure HELLO is
  436. begin
  437.    PUT_LINE("Hello!");
  438. end HELLO;
  439.  
  440.  
  441.  
  442. ADD.ADA
  443. -------
  444.  
  445. with TEXT_IO; use TEXT_IO;
  446. procedure ADD is
  447.    package MY_INT_IO is new INTEGER_IO(INTEGER); use MY_INT_IO;
  448. begin
  449.    PUT(2 + 2);
  450.    NEW_LINE;
  451. end ADD;
  452.  
  453.                                                                Page 10
  454.  
  455. TRITEST.ADA
  456. -----------
  457.  
  458. with TEXT_IO; use TEXT_IO;
  459. procedure TRITEST is
  460.    PASSED : BOOLEAN := TRUE;
  461.    type TRIANGLE is (EQUILATERAL, ISOSCELES, SCALENE, NOT_A_TRIANGLE);
  462.    function TRITYPE(LEN1, LEN2, LEN3 : in INTEGER) return TRIANGLE
  463.                                                           is separate;
  464.    procedure COMPARE(A, B, C: in INTEGER; RIGHT_ANSWER : in TRIANGLE)
  465.                                                           is separate;
  466. begin
  467.    COMPARE( 3,  4,  5, SCALENE);
  468.    COMPARE( 6,  3,  4, SCALENE);
  469.    COMPARE( 4,  3,  6, SCALENE);
  470.    COMPARE( 3,  3,  3, EQUILATERAL);
  471.    COMPARE( 3,  3,  4, ISOSCELES);
  472.    COMPARE( 3,  4,  3, ISOSCELES);
  473.    COMPARE( 4,  3,  3, ISOSCELES);
  474.    COMPARE( 7,  7,  4, ISOSCELES);
  475.    COMPARE( 7,  4,  7, ISOSCELES);
  476.    COMPARE( 4,  7,  7, ISOSCELES);
  477.    COMPARE( 1,  1,  1, EQUILATERAL);
  478.    COMPARE( 0,  4,  4, NOT_A_TRIANGLE);
  479.    COMPARE( 4,  0,  4, NOT_A_TRIANGLE);
  480.    COMPARE( 4,  4,  0, NOT_A_TRIANGLE);
  481.    COMPARE( 0,  4,  3, NOT_A_TRIANGLE);
  482.    COMPARE( 3,  0,  4, NOT_A_TRIANGLE);
  483.    COMPARE( 4,  3,  0, NOT_A_TRIANGLE);
  484.    COMPARE(-1,  4,  4, NOT_A_TRIANGLE);
  485.    COMPARE( 4, -1,  4, NOT_A_TRIANGLE);
  486.    COMPARE( 4,  4, -1, NOT_A_TRIANGLE);
  487.    COMPARE(-1,  4,  3, NOT_A_TRIANGLE);
  488.    COMPARE( 3, -1,  4, NOT_A_TRIANGLE);
  489.    COMPARE( 4,  3, -1, NOT_A_TRIANGLE);
  490.    COMPARE( 2,  4,  6, NOT_A_TRIANGLE);
  491.    COMPARE( 1,  3,  2, NOT_A_TRIANGLE);
  492.    COMPARE( 3,  1,  2, NOT_A_TRIANGLE);
  493.    COMPARE( 1,  2,  4, NOT_A_TRIANGLE);
  494.    COMPARE( 1,  4,  2, NOT_A_TRIANGLE);
  495.    COMPARE( 4,  1,  2, NOT_A_TRIANGLE);
  496.    COMPARE( 0,  0,  0, NOT_A_TRIANGLE);
  497.    COMPARE( 0,  0,  4, NOT_A_TRIANGLE);
  498.    COMPARE( 0,  4,  0, NOT_A_TRIANGLE);
  499.    COMPARE( 4,  0,  0, NOT_A_TRIANGLE);
  500.    COMPARE( 3,  3,  7, NOT_A_TRIANGLE);
  501.    COMPARE( 3,  7,  3, NOT_A_TRIANGLE);
  502.    COMPARE( 6,  3,  3, NOT_A_TRIANGLE);
  503.    COMPARE(-3, -4, -5, NOT_A_TRIANGLE);
  504.    if PASSED then
  505.       PUT_LINE("Congratulations, you completed the assignment!");
  506.    end if;
  507. end TRITEST;
  508.                            -- continued --
  509.  
  510.                                                                Page 11
  511.  
  512. separate (TRITEST)
  513. procedure COMPARE(A, B, C: in INTEGER; RIGHT_ANSWER : in TRIANGLE) is
  514.    package INT_IO is new INTEGER_IO(INTEGER); use INT_IO;
  515.    package TRI_IO is new ENUMERATION_IO(TRIANGLE); use TRI_IO;
  516.    MY_ANSWER : TRIANGLE := TRITYPE(A, B, C);
  517. begin
  518.    if MY_ANSWER /= RIGHT_ANSWER then
  519.       PUT("Sides:");
  520.       PUT(A, WIDTH => 3);
  521.       PUT(B, WIDTH => 3);
  522.       PUT(C, WIDTH => 3);
  523.       PUT("   My answer: ");
  524.       PUT(MY_ANSWER, WIDTH => 14);
  525.       PUT("   Right answer: ");
  526.       PUT(RIGHT_ANSWER);
  527.       NEW_LINE;
  528.       PASSED := FALSE;
  529.    end if;
  530. end COMPARE;
  531.  
  532.                                                                Page 12
  533.  
  534.     STEPS FOR OUTSIDE ASSIGNMENT 2, EXERCISE IN ENUMERATION TYPES
  535.  
  536. 1.  Compile the test driver TRITEST.ADA.  Also, make a copy of the
  537.     dummy solution by typing COPY TRITYPE.DUM TRITYPE.ADA.  You need
  538.     do this step only once.
  539.  
  540. 2.  Edit TRITYPE.ADA to become your real solution.  You can skip this
  541.     step the first time through, to see error messages from the test
  542.     driver.
  543.  
  544. 3.  Compile your solution TRITYPE.ADA.  If the compiler finds errors,
  545.     go back to step 2.
  546.  
  547. 4.  Link with the name of the main program TRITEST.  Then execute.  If
  548.     the test driver displays error messages, go back to step 2.
  549.  
  550. 5.  When the message "Congratulations, you completed the assignment!"
  551.     is displayed, you'll have a chance to compare your solution with
  552.     ours.
  553.  
  554.                                                                Page 13
  555.  
  556. NEXTDATE.ADA
  557. ------------
  558.  
  559. with TEXT_IO; use TEXT_IO;
  560. procedure NEXTDATE is
  561.    type MONTH_TYPE is
  562.       (JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC);
  563.    subtype DAY_SUBTYPE is INTEGER range 1 .. 31;
  564.    type DATE is
  565.       record
  566.          DAY   : DAY_SUBTYPE;
  567.          MONTH : MONTH_TYPE;
  568.          YEAR  : POSITIVE;
  569.       end record;
  570.    PASSED : BOOLEAN := TRUE;
  571.    function TOMORROW(TODAY : in DATE) return DATE is separate;
  572.  
  573.    procedure DISPLAY (S : in STRING; D : in DATE) is
  574.       package INT_IO is new INTEGER_IO(INTEGER); use INT_IO;
  575.    begin
  576.       PUT(S);
  577.       PUT(D.DAY, WIDTH => 3);
  578.       PUT(" " & MONTH_TYPE'IMAGE(D.MONTH));
  579.       PUT(D.YEAR, WIDTH => 5);
  580.       NEW_LINE;
  581.    end DISPLAY;
  582.    procedure COMPARE(TODAY, RIGHT_ANSWER : in DATE) is
  583.       MY_ANSWER : DATE := TOMORROW(TODAY);
  584.    begin
  585.       if MY_ANSWER /= RIGHT_ANSWER then
  586.          DISPLAY("Today:       ", TODAY);
  587.          DISPLAY("My answer:   ", MY_ANSWER);
  588.          DISPLAY("Right answer:", RIGHT_ANSWER);
  589.          NEW_LINE;
  590.          PASSED := FALSE;
  591.       end if;
  592.    end COMPARE;
  593. begin
  594.    COMPARE((12,DEC,1815), (13,DEC,1815)); -- ordinary date
  595.    COMPARE(( 3,FEB,1986), ( 4,FEB,1986)); -- ordinary date in Feb.
  596.    COMPARE((30,JUN,1981), ( 1,JUL,1981)); -- last day of 30-day month
  597.    COMPARE((30,SEP,3999), ( 1,OCT,3999)); -- last day of 30-day month
  598.    COMPARE((31,MAR,1876), ( 1,APR,1876)); -- last day of 31-day month
  599.    COMPARE((31,AUG,1984), ( 1,SEP,1984)); -- last day of 31-day month
  600.    COMPARE((31,DEC,1966), ( 1,JAN,1967)); -- last day of year
  601.    COMPARE((28,FEB,1980), (29,FEB,1980)); -- leap year
  602.    COMPARE((28,FEB,1600), (29,FEB,1600)); -- century leap year
  603.    COMPARE((28,FEB,2200), ( 1,MAR,2200)); -- century non-leap year
  604.    COMPARE((28,FEB,1982), ( 1,MAR,1982)); -- non-leap year
  605.    COMPARE((29,FEB,1980), ( 1,MAR,1980)); -- leap day in leap year
  606.    if PASSED then
  607.       PUT_LINE("Congratulations, you completed the assignment!");
  608.    end if;
  609. end NEXTDATE;
  610.  
  611.                                                                Page 14
  612.  
  613.          STEPS FOR OUTSIDE ASSIGNMENT 3, EXERCISE IN RECORDS
  614.  
  615. 1.  Compile the test driver NEXTDATE.ADA.  Also, make a copy of the
  616.     dummy solution by typing COPY TOMORROW.DUM TOMORROW.ADA.  You need
  617.     do this step only once.
  618.  
  619. 2.  Edit TOMORROW.ADA to become your real solution.  You can skip this
  620.     step the first time through, to see error messages from the test
  621.     driver.
  622.  
  623. 3.  Compile TOMORROW.ADA.  If the compiler finds errors, go back to
  624.     step 2.
  625.  
  626. 4.  Link with the name of the main program NEXTDATE.  Then execute.
  627.     If the test driver displays error messages, go back to step 2.
  628.  
  629. 5.  When the message "Congratulations, you completed the assignment!"
  630.     is displayed, you'll have a chance to compare your solution with
  631.     ours.
  632.  
  633.                                                                Page 15
  634.  
  635. FIBTEST.ADA
  636. -----------
  637.  
  638. with TEXT_IO; use TEXT_IO;
  639. procedure FIBTEST is
  640.    PASSED : BOOLEAN := TRUE;
  641.    function FIB(N : in POSITIVE) return POSITIVE is separate;
  642.    procedure COMPARE (N : in POSITIVE; RIGHT_ANSWER : in POSITIVE) is
  643.       package INT_IO is new INTEGER_IO(INTEGER); use INT_IO;
  644.       MY_ANSWER : POSITIVE := FIB(N);
  645.    begin
  646.       if MY_ANSWER /= RIGHT_ANSWER then
  647.          PUT("N:");  PUT(N);
  648.          PUT("          My answer:");  PUT(MY_ANSWER);
  649.          PUT("          Right answer:");  PUT(RIGHT_ANSWER);
  650.          NEW_LINE;
  651.          PASSED := FALSE;
  652.       end if;
  653.    end COMPARE;
  654. begin
  655.    COMPARE(1, 1);
  656.    COMPARE(2, 1);
  657.    COMPARE(3, 2);
  658.    COMPARE(4, 3);
  659.    COMPARE(5, 5);
  660.    COMPARE(6, 8);
  661.    COMPARE(7, 13);
  662.    COMPARE(10, 55);
  663.    COMPARE(15, 610);
  664.    COMPARE(20, 6765);
  665.    if PASSED then
  666.       PUT_LINE("Congratulations, you completed the assignment!");
  667.    end if;
  668. end FIBTEST;
  669.  
  670.                                                                Page 16
  671.  
  672.         STEPS FOR OUTSIDE ASSIGNMENT 4, EXERCISE IN RECURSION
  673.  
  674. 1.  Compile the test driver FIBTEST.ADA.  Also, make a copy of the
  675.     dummy solution by typing COPY FIB.DUM FIB.ADA.  You need do this
  676.     step only once.
  677.  
  678. 2.  Edit FIB.ADA to become your real solution.  You can skip this step
  679.     the first time through, to see error messages from the test
  680.     driver.
  681.  
  682. 3.  Compile FIB.ADA.  If the compiler finds errors, go back to step 2.
  683.  
  684. 4.  Link with the name of the main program FIBTEST.  Then execute.  If
  685.     the test driver displays error messages, go back to step 2.
  686.  
  687. 5.  When the message "Congratulations, you completed the assignment!"
  688.     is displayed, you'll have a chance to compare your solution with
  689.     ours.
  690.  
  691.                                                                Page 17
  692.  
  693. SIMPLIFIED SPECIFICATION FOR TEXT_IO
  694. ------------------------------------
  695.  
  696. package TEXT_IO is
  697.    type FILE_TYPE is limited private;
  698.  
  699.    type FILE_MODE is (IN_FILE, OUT_FILE);
  700.    type COUNT is ... (a user-defined type similar to INTEGER);
  701.    STATUS_ERROR, MODE_ERROR, NAME_ERROR, END_ERROR : exception;
  702.  
  703.    procedure CREATE      (FILE : in out FILE_TYPE;
  704.                           MODE : in FILE_MODE := OUT_FILE;
  705.                           NAME : in STRING);
  706.  
  707.    procedure OPEN        (FILE : in out FILE_TYPE;
  708.                           MODE : in FILE_MODE;
  709.                           NAME : in STRING);
  710.  
  711.    procedure CLOSE       (FILE : in out FILE_TYPE);
  712.    procedure DELETE      (FILE : in out FILE_TYPE);
  713.    procedure NEW_LINE    (SPACING : in COUNT := 1);
  714.    procedure NEW_LINE    (FILE : in FILE_TYPE;
  715.                           SPACING : in COUNT := 1);
  716.    procedure SKIP_LINE   (SPACING : in COUNT := 1);
  717.    procedure SKIP_LINE   (FILE : in FILE_TYPE;
  718.                           SPACING : in COUNT := 1);
  719.    function  END_OF_FILE (FILE : in FILE_TYPE) return BOOLEAN;
  720.    procedure PUT         (ITEM : in CHARACTER);
  721.    procedure PUT         (FILE : in FILE_TYPE; ITEM : in CHARACTER);
  722.    procedure GET         (ITEM : out CHARACTER);
  723.    procedure GET         (FILE : in FILE_TYPE; ITEM : out CHARACTER);
  724.    procedure PUT         (ITEM : in STRING);
  725.    procedure PUT         (FILE : in FILE_TYPE; ITEM : in STRING);
  726.    procedure PUT_LINE    (ITEM : in STRING);
  727.    procedure PUT_LINE    (FILE : in FILE_TYPE; ITEM : in STRING);
  728.    procedure GET_LINE    (ITEM : out STRING; LAST : out NATURAL);
  729.    procedure GET_LINE    (FILE : in FILE_TYPE;
  730.                           ITEM : out STRING;
  731.                           LAST : out NATURAL);
  732.    generic
  733.       type NUM is range <>;
  734.    package INTEGER_IO is
  735.       procedure GET (ITEM : out NUM);
  736.       procedure GET (FILE : in FILE_TYPE; ITEM : out NUM);
  737.       procedure PUT (ITEM  : in NUM;
  738.                      WIDTH : in INTEGER := ...;
  739.                      BASE  : in INTEGER := 10);
  740.       procedure PUT (FILE  : in FILE_TYPE;
  741.                      ITEM  : in NUM;
  742.                      WIDTH : in INTEGER := ...;
  743.                      BASE  : in INTEGER := 10);
  744.    end INTEGER_IO;
  745.  
  746.                            -- continued --
  747.  
  748.                                                                Page 18
  749.  
  750.    generic
  751.       type NUM is digits <>;
  752.    package FLOAT_IO is
  753.       procedure GET (ITEM : out NUM);
  754.       procedure GET (FILE : in FILE_TYPE; ITEM : out NUM);
  755.       procedure PUT (ITEM : in NUM;
  756.                      FORE : in INTEGER := 2;
  757.                      AFT  : in INTEGER := ...;
  758.                      EXP  : in INTEGER := 3);
  759.       procedure PUT (FILE : in FILE_TYPE;
  760.                      ITEM : in NUM;
  761.                      FORE : in INTEGER := 2;
  762.                      AFT  : in INTEGER := ...;
  763.                      EXP  : in INTEGER := 3);
  764.    end FLOAT_IO;
  765.  
  766.    generic
  767.       type ENUM is (<>);
  768.    package ENUMERATION_IO is
  769.       procedure GET (ITEM : out ENUM);
  770.       procedure GET (FILE : in FILE_TYPE; ITEM : out ENUM);
  771.       procedure PUT (ITEM : in ENUM; WIDTH : in INTEGER := 0);
  772.       procedure PUT (FILE : in FILE_TYPE;
  773.                      ITEM : in ENUM; WIDTH : in INTEGER := 0);
  774.    end ENUMERATION_IO;
  775.  
  776. private
  777.  
  778.    type FILE_TYPE is ... (implementation dependent);
  779.  
  780. end TEXT_IO;
  781.  
  782.                                                                Page 19
  783.  
  784. Program to copy a simple text file:
  785. -----------------------------------
  786.  
  787. with TEXT_IO; use TEXT_IO;
  788. procedure FILECOPY is
  789.    F1, F2 : FILE_TYPE;
  790.    S      : STRING(1 .. 80);
  791.    LEN    : INTEGER;
  792. begin
  793.    PUT("Input file: ");  GET_LINE(S, LEN);
  794.    OPEN(FILE => F1, MODE => IN_FILE, NAME => S(1 .. LEN));
  795.    PUT("Output file: ");  GET_LINE(S, LEN);
  796.    CREATE(FILE => F2, MODE => OUT_FILE, NAME => S(1 .. LEN));
  797.    while not END_OF_FILE(F1) loop
  798.       GET_LINE(F1, S, LEN);
  799.       PUT_LINE(F2, S(1 .. LEN));
  800.    end loop;
  801.    CLOSE(F1);
  802.    CLOSE(F2);
  803. end FILECOPY;
  804.  
  805.  
  806.  
  807. Function to test if a text file exists:
  808. ---------------------------------------
  809.  
  810. with TEXT_IO; use TEXT_IO;
  811. function EXISTS(FILE_NAME : in STRING) return BOOLEAN is
  812.    F      : FILE_TYPE;
  813.    ANSWER : BOOLEAN := TRUE;
  814. begin
  815.    begin
  816.       OPEN(F, IN_FILE, FILE_NAME);
  817.       CLOSE(F);
  818.    exception
  819.       when NAME_ERROR => ANSWER := FALSE;
  820.    end;
  821.    return ANSWER;
  822. end EXISTS;
  823.  
  824.                                                                Page 20
  825.  
  826.                  REQUIREMENTS FOR THE PROGRAM LEDIT
  827.  
  828. This assignment will give you practice in writing a program of greater
  829. complexity than the previous programs you've written.  Imagine that
  830. your screen editor is unavailable to a particular user, perhaps
  831. because he's dialing your computer from a remote location, and your
  832. screen editor writes directly to the screen.  You want to write a very
  833. simple line editor, LEDIT, that could be used in such circumstances.
  834. While your computer already has a line editor called EDLIN, it's
  835. difficult to learn to use.  LEDIT will take almost no effort to learn.
  836. The only commands are LIST and EXIT!  The line editor edits by means
  837. of line numbers, similar to the Basic language.
  838.  
  839. The user begins each line of text that he types with a line number
  840. from 1 to 29999.  Line numbers must be integers.  The upper limit
  841. 29999 was chosen so that the simple type INTEGER could be used - in
  842. any implementation of Ada.   Regardless of the order in which lines
  843. are typed, LEDIT maintains a linked list of lines in order by number.
  844. Also, line numbers may be preceded by any number of spaces.  For
  845. example, if the user types
  846.  
  847. 40 -- This is a comment.
  848.    20 begin
  849. 10 with TEXT_IO; use TEXT_IO;
  850.       30 end ADD;
  851.  
  852. and then types LIST, the editor will type
  853.  
  854.    10 with TEXT_IO; use TEXT_IO;
  855.    20 begin
  856.    30 end ADD;
  857.    40 -- This is a comment.
  858.  
  859. To INSERT lines, the user merely types lines with intermediate line
  860. numbers.  For example, if he types
  861.  
  862. 15 procedure HELLO is
  863.  
  864. and then types LIST, LEDIT will type
  865.  
  866.    10 with TEXT_IO; use TEXT_IO;
  867.    15 procedure HELLO is
  868.    20 begin
  869.    30 end ADD;
  870.    40 -- This is a comment.
  871.  
  872. To REPLACE an existing line, the user merely types a line with the
  873. same line number as the line to be replaced.  For example, if he typed
  874.  
  875. 15 procedure ADD is
  876. LIST
  877.  
  878.  
  879.                            -- continued --
  880.  
  881.                                                                Page 21
  882.  
  883. LEDIT would then show
  884.  
  885.    10 with TEXT_IO; use TEXT_IO;
  886.    15 procedure ADD is
  887.    20 begin
  888.    30 end ADD;
  889.    40 -- This is a comment.
  890.  
  891. Finally, to DELETE a line, the user merely types the number of the
  892. line to be deleted, followed immediately by a carriage return.  Typing
  893.  
  894. 40
  895. LIST
  896.  
  897. would then produce
  898.  
  899.    10 with TEXT_IO; use TEXT_IO;
  900.    15 procedure ADD is
  901.    20 begin
  902.    30 end ADD;
  903.  
  904. Thus the user can INSERT, REPLACE, and DELETE lines, all by line
  905. numbers, without learning any commands.  Note that in this simple
  906. editor there is no "cursor" and no "current line."
  907.  
  908. The space is not required after the line number.  These two lines have
  909. exactly the same effect:
  910.  
  911. 20 begin
  912. 20begin
  913.  
  914. Of course, if the text of the line begins with a digit, a space will
  915. be required to separate it from the line number.  In any event, LEDIT
  916. always leaves one blank space after the line number when LISTing, for
  917. readability.  It always allows exactly five spaces for the line number
  918. itself.
  919.  
  920. However, any EXTRA spaces typed after the line number are significant.
  921. The three lines below each contain three EXTRA spaces after the line
  922. number, for a total of four spaces.
  923.  
  924. 24    PUT(2 + 2);
  925. 26    NEW_LINE;
  926. 18    package MY_INT_IO is new INTEGER_IO(INTEGER); use MY_INT_IO;
  927.  
  928. They have the effect of indenting the text three spaces.  LIST now
  929. shows
  930.  
  931.  
  932.                            -- continued --
  933.  
  934.                                                                Page 22
  935.  
  936.    10 with TEXT_IO; use TEXT_IO;
  937.    15 procedure ADD is
  938.    18    package MY_INT_IO is new INTEGER_IO(INTEGER); use MY_INT_IO;
  939.    20 begin
  940.    24    PUT(2 + 2);
  941.    26    NEW_LINE;
  942.    30 end ADD;
  943.  
  944. Although typing a line number followed immediately by a carriage
  945. return deletes a line (if there is a line by that number), typing a
  946. line number followed by a single space causes an empty line to be
  947. introduced into the file.  For example, typing 12 followed by a single
  948. space and a carriage return would then cause LIST to type
  949.  
  950.    10 with TEXT_IO; use TEXT_IO;
  951.    12
  952.    15 procedure ADD is
  953.    18    package MY_INT_IO is new INTEGER_IO(INTEGER); use MY_INT_IO;
  954.    20 begin
  955.    24    PUT(2 + 2);
  956.    26    NEW_LINE;
  957.    30 end ADD;
  958.  
  959. When LEDIT is run, it prompts for the names of the input and output
  960. files.  If the input file exists, LEDIT displays "File found" and
  961. reads the file into its linked list, assigning line numbers starting
  962. with 10 and incrementing by 10.  If the file does not exist, LEDIT
  963. displays "File not found," and the linked list is initially empty.  In
  964. any event, LEDIT creates an output file.  When the EXIT command is
  965. given, LEDIT writes the contents of the linked list to the output
  966. file.  In doing so, LEDIT removes the line numbers and the first blank
  967. after each line number.
  968.  
  969. In the example above, let us assume that the user typed ADD.ADA for an
  970. output file name.  When he types EXIT, the new file ADD.ADA created by
  971. LEDIT will contain:
  972.  
  973. with TEXT_IO; use TEXT_IO;
  974.  
  975. procedure ADD is
  976.    package MY_INT_IO is new INTEGER_IO(INTEGER); use MY_INT_IO;
  977. begin
  978.    PUT(2 + 2);
  979.    NEW_LINE;
  980. end ADD;
  981.  
  982. (Note that the file contains one empty line.)  Your program is not
  983. allowed to add any trailing blanks of its own in the output file.  If
  984. the user again runs LEDIT and specifies ADD.ADA as an input file, the
  985. editor will type "File found" and read the file.  LIST will then show
  986.  
  987.  
  988.                            -- continued --
  989.  
  990.                                                                Page 23
  991.  
  992.    10 with TEXT_IO; use TEXT_IO;
  993.    20
  994.    30 procedure ADD is
  995.    40    package MY_INT_IO is new INTEGER_IO(INTEGER); use MY_INT_IO;
  996.    50 begin
  997.    60    PUT(2 + 2);
  998.    70    NEW_LINE;
  999.    80 end ADD;
  1000.  
  1001. When he EXITs, the new file will contain modified text.  The old file
  1002. will still be present until it is deleted.
  1003.  
  1004. The two commands LIST and EXIT must be accepted in either upper or
  1005. lower case, but for simplicity, they need not be accepted in a mixture
  1006. of cases.  They may be preceded by any number of spaces.  The LIST
  1007. command must be accepted in any of the following forms:
  1008.  
  1009. LIST            (Lists all lines, if any, otherwise does nothing.)
  1010. list 30         (Lists line 30, if it exists.)
  1011. list 25 - 35    (Lists all lines between 25 and 35 inclusive, if any.)
  1012. LIST - 35       (Lists all lines numbered 35 or less, if any.)
  1013. list 25 -       (Lists all lines numbered 25 or more, if any.)
  1014.  
  1015. Furthermore, all spaces are optional in the LIST command provided that
  1016. LIST is written solid, so that LIST25-35 is equivalent to the third
  1017. example above.  Any other forms of LIST should be flagged as an error.
  1018. In particular, all of these should give error messages:
  1019.  
  1020. LIST -
  1021. list 2A
  1022. LIST 30 - 50 -
  1023. list 30 - -50
  1024. list 30-A
  1025. LIST XYZ
  1026.  
  1027. The EXIT command must stand alone; unlike LIST, EXIT is never followed
  1028. by anything.  Except for the LIST and EXIT commands, every line typed
  1029. must begin with a number between 1 and 29999.  (Of course, the user
  1030. should be able to type just a carriage return with no effect.)  LEDIT
  1031. should check that line numbers are in range when adding or replacing
  1032. lines.  The LIST command need not check the range of the line numbers,
  1033. because it should be impossible to create lines with improper numbers.
  1034. Your program need not handle input files so long that 29999 would be
  1035. exceeded when it assigns line numbers starting at 10 with an increment
  1036. of 10.
  1037.  
  1038. Your LEDIT must prompt for input and output file names at the start,
  1039. and it may display a prompt for each line that the user types.  You
  1040. may assume some maximum length for an input line (e.g., 80), and
  1041. assume that no file will have lines longer than the maximum.  You may
  1042. also assume that no file will have special characters like form feeds.
  1043.  
  1044.  
  1045.                            -- continued --
  1046.  
  1047.                                                                Page 24
  1048.  
  1049. For simplicity, there's no way to edit a line except by retyping it.
  1050. Also, there's no way to copy or move a line or a block of lines, and
  1051. no way to delete a block of lines except one line at a time.  There's
  1052. no RENUMBER command.  The user can renumber the entire file starting
  1053. at 10 with an increment of 10 by EXITing and then rerunning LEDIT.
  1054. There's no AUTO command to make the editor type the line numbers
  1055. automatically while text is being typed by the user, and there's no
  1056. means of recovering from a system crash that occurs during an edit.
  1057. Additionally, there's no way to search for a string, or replace one
  1058. string with another.  These features would all be desirable, but we
  1059. feel that Outside Assignment 5 is challenging as it stands.
  1060.  
  1061. You're encouraged to use Ada's "separate" compilation feature, so that
  1062. you don't have to recompile the entire program when developing a
  1063. module.
  1064.  
  1065. As a point of reference, our solution to this assignment consists of
  1066. about 180 lines of code on four pages.  If you have any questions
  1067. about what LEDIT should do, you can compile and run our solution,
  1068. which is in LEDIT.ANS.
  1069.  
  1070. The following declarations are offered by way of suggestion only, and
  1071. you should use them only if you feel comfortable with them:
  1072.  
  1073.      MAX_LENGTH : constant INTEGER := 80;
  1074.      type TEXT is
  1075.         record
  1076.            LEN : INTEGER range 0 .. MAX_LENGTH;
  1077.            VAL : STRING(1 .. MAX_LENGTH);
  1078.         end record;
  1079.  
  1080.      type LINK;
  1081.      type P is access LINK;
  1082.      type LINK is
  1083.         record
  1084.            NUM  : POSITIVE;
  1085.            LINE : TEXT;
  1086.            NEXT : P;
  1087.         end record;
  1088.  
  1089.      function STR(T : in TEXT) return STRING;
  1090.  
  1091. In our solution, we used type TEXT as above.  However, we didn't write
  1092. a TEXT_HANDLER package, because it didn't seem to be needed.  We used
  1093. a one-page main program with several "separate" subprograms.
  1094.  
  1095.                                                                Page 25
  1096.  
  1097.     STEPS FOR OUTSIDE ASSIGNMENT 5, WRITING A SIMPLE LINE EDITOR
  1098.  
  1099. 1.  Carefully read the requirements starting on page 20 of these
  1100.     notes.  Take your time.
  1101.  
  1102. 2.  Write the Ada code, compile, and link.  Call the main program
  1103.     LEDIT.  If you have any questions about what LEDIT should do, you
  1104.     can compile and run our solution, which is in LEDIT.ANS.
  1105.  
  1106. 3.  Refer to pages 26-28 of these notes for instructions on testing
  1107.     your line editor.  If any tests are failed, go back to step 2.
  1108.  
  1109. 4.  When all the tests are passed, you've completed the assignment and
  1110.     will have a chance to compare your solution with ours.
  1111.  
  1112.                                                                Page 26
  1113.  
  1114.                           HOW TO TEST LEDIT
  1115.  
  1116. 1.  Run LEDIT and give the name of an input file that doesn't exist.
  1117. LEDIT should say "File not found."  Give another name of a file that
  1118. doesn't exist for an output file.
  1119.  
  1120. 2.  Type "LIST" (without the quotes) to make sure that LEDIT can
  1121. handle the LIST command when no text has been entered.
  1122.  
  1123. 3.  Type "EXI".  The program should NOT exit.  If it exits, it's
  1124. probably because the "T" was left in the input buffer from the LIST
  1125. command.  Your program is checking the first four characters of the
  1126. input buffer without checking the length of the typed command.
  1127.  
  1128. 4.  Type "ABC".  The program should display a message about an illegal
  1129. or unrecognized command, or syntax error.
  1130.  
  1131. 5.  Type "0X" (zero followed by X).  The program should reject this
  1132. line, displaying a message about an invalid line number.  Type "0 X".
  1133. The same thing should happen.  Try "30000X", then "30000 X", and then
  1134. "3000000000 X".  The program should reject these, as well.
  1135.  
  1136. 6.  Type "-1 X" and "-1X".  The program should reject these lines,
  1137. displaying a message either about an unrecognized command (or syntax
  1138. error), or an invalid line number.
  1139.  
  1140. 7.  Type a simple carriage return.  There should be no effect, except
  1141. for any prompt being repeated.
  1142.  
  1143. 8.  Type the following exactly as shown.  Note that lines 1000 and 100
  1144. each contain four spaces:
  1145.  
  1146. 30 X
  1147. 1 The
  1148. 29999 ZZZZZZZZ
  1149. 1000    used
  1150. 100    is
  1151. 10000 to test
  1152.    30file --
  1153. 1 This
  1154.     29999 LEDIT.
  1155.  
  1156. 9.  Type "list".  You should see the following, lined up exactly as
  1157. shown.  There should be exactly five spaces for the line numbers.
  1158.  
  1159.     1 This
  1160.    30 file --
  1161.   100    is
  1162.  1000    used
  1163. 10000 to test
  1164. 29999 LEDIT.
  1165.  
  1166.  
  1167.                            -- continued --
  1168.  
  1169.                                                                Page 27
  1170.  
  1171. 10.  Try a line of text beginning with a number: "20000 123 45".  Then
  1172. type "   LIST" with three leading spaces.  You should see
  1173.  
  1174.     1 This
  1175.    30 file --
  1176.   100    is
  1177.  1000    used
  1178. 10000 to test
  1179. 20000 123 45
  1180. 29999 LEDIT.
  1181.  
  1182. 11.  Insert an empty line by typing "15000 ".  Then type "LIST".  You
  1183. should see
  1184.  
  1185.     1 This
  1186.    30 file --
  1187.   100    is
  1188.  1000    used
  1189. 10000 to test
  1190. 15000
  1191. 20000 123 45
  1192. 29999 LEDIT.
  1193.  
  1194. 12.  Type "EXIT ABC".  LEDIT should display a error message and NOT
  1195. exit.  The requirements say that the EXIT command must stand alone.
  1196.  
  1197. 13.  Type "   exit".  LEDIT should exit, and you should have a new
  1198. file with the output file name you gave in step 1.  Type the file with
  1199. the TYPE command.  You should see exactly this, starting in column 1:
  1200.  
  1201. This
  1202. file --
  1203.    is
  1204.    used
  1205. to test
  1206.  
  1207. 123 45
  1208. LEDIT.
  1209.  
  1210. 14.  Run LEDIT again, using for an input file the name of the OUTPUT
  1211. file you specified in step 1.  This time the program should say "File
  1212. found."  Choose yet another name for an output file for this step.
  1213. Type "list".  You should see the following, exactly as shown:
  1214.  
  1215.    10 This
  1216.    20 file --
  1217.    30    is
  1218.    40    used
  1219.    50 to test
  1220.    60
  1221.    70 123 45
  1222.    80 LEDIT.
  1223.  
  1224.                            -- continued --
  1225.  
  1226.                                                                Page 28
  1227.  
  1228. 15.  Type "  LIST 30".  You should see only line 30.  Type
  1229. "list25-45".  You should see only lines 30 and 40.  Type "LIST  - 40".
  1230. You should see lines 10 through 40.  Type "list35 -".  You should see
  1231. lines 40 through 80.  Type "list 15".  The program should either do
  1232. nothing or display a message that line 15 doesn't exist.  Try
  1233. "list 30000" and "list 3000000000".  Again, the program should either
  1234. do nothing or display an error message.  Now type "list" and check
  1235. that the result is the same as in step 14.
  1236.  
  1237. 16.  Try each of the following.  In each case, LEDIT should display an
  1238. error message:
  1239.  
  1240. LIST -
  1241. list 2A
  1242. list 30 - 50 -
  1243. list 30 - -50
  1244.    list 30-A
  1245. LIST XYZ
  1246.  
  1247. 17.  Type "70" to delete line 70.  Type "LIST".  You should see
  1248.  
  1249.    10 This
  1250.    20 file --
  1251.    30    is
  1252.    40    used
  1253.    50 to test
  1254.    60
  1255.    80 LEDIT.
  1256.  
  1257. 18.  Delete line 60.  Do not list.  Now delete line 80 and list.  You
  1258. should see
  1259.  
  1260.    10 This
  1261.    20 file --
  1262.    30    is
  1263.    40    used
  1264.    50 to test
  1265.  
  1266. 19.  Delete line 10 and list.  You should see lines 20 through 50
  1267. above.  Delete line 50 and list.  You should see lines 20 through 40.
  1268. Delete line 30 and list.  You should see lines 20 and 40.  Delete line
  1269. 40 and list.  You should see only line 20.  Delete line 20 and list.
  1270. The result should be the same as in step 2.  Type "EXIT".
  1271.  
  1272. 20.  If your program passed all these tests, sincere congratulations!
  1273. You've completed a difficult assignment.  We hope that you feel
  1274. comfortable with Ada now.  If you like, you can compare your solution
  1275. with ours, starting on page 29 of these notes.  When you go back to
  1276. ADA-TUTR, you'll learn to write your own generic packages, procedures,
  1277. and functions.
  1278.  
  1279.                                                                Page 29
  1280.  
  1281. LEDIT.ANS
  1282. ---------
  1283.  
  1284. -- Our solution to Outside Assignment 5:
  1285. with TEXT_IO; use TEXT_IO;
  1286. procedure LEDIT is
  1287.    MAX_LENGTH      : constant := 80;
  1288.    MAX_LINE_NUMBER : constant := 29_999;
  1289.    type TEXT is
  1290.       record
  1291.          LEN : INTEGER range 0 .. MAX_LENGTH := 0;
  1292.          VAL : STRING(1 .. MAX_LENGTH);
  1293.       end record;
  1294.    type LINK;
  1295.    type P is access LINK;
  1296.    type LINK is
  1297.       record
  1298.          NUM  : POSITIVE;
  1299.          LINE : TEXT;
  1300.          NEXT : P;
  1301.       end record;
  1302.    HEAD            : P := new LINK;
  1303.    TEMP            : P;
  1304.    INPUT_FILE      : FILE_TYPE;
  1305.    OUTPUT_FILE     : FILE_TYPE;
  1306.    INPUT           : TEXT;
  1307.    FINISHED        : BOOLEAN := FALSE;
  1308.    LINE_NUM        : NATURAL := 10;
  1309.  
  1310.    function  STR(T : in TEXT) return STRING is separate;
  1311.    procedure READ_INPUT_FILE is separate;
  1312.    procedure DO_COMMAND is separate;
  1313. begin
  1314.    PUT("Input file: ");  GET_LINE(INPUT.VAL, INPUT.LEN);
  1315.    READ_INPUT_FILE;
  1316.    PUT("Output file: ");  GET_LINE(INPUT.VAL, INPUT.LEN);
  1317.    CREATE(OUTPUT_FILE, NAME => STR(INPUT));
  1318.  
  1319.    -- Get and process commands.
  1320.    while not FINISHED loop
  1321.       PUT("> ");  GET_LINE(INPUT.VAL, INPUT.LEN);
  1322.       DO_COMMAND;
  1323.    end loop;
  1324.  
  1325.    -- Write the output file.
  1326.    TEMP := HEAD.NEXT;     -- Skip unused link at start of linked list.
  1327.    while TEMP /= null loop
  1328.       PUT_LINE(OUTPUT_FILE, STR(TEMP.LINE));    -- Write line of text.
  1329.       TEMP := TEMP.NEXT;                             -- Get next link.
  1330.    end loop;
  1331.    CLOSE(OUTPUT_FILE);
  1332. end LEDIT;
  1333.  
  1334.                            -- continued --
  1335.  
  1336.                                                                Page 30
  1337.  
  1338. separate (LEDIT)
  1339. function STR(T : in TEXT) return STRING is
  1340. begin
  1341.    return T.VAL(1 .. T.LEN);
  1342. end STR;
  1343.  
  1344. separate (LEDIT)
  1345. procedure READ_INPUT_FILE is
  1346. begin   -- If the input file exists, display a message and read it in.
  1347.    OPEN(INPUT_FILE, IN_FILE, STR(INPUT));
  1348.    PUT_LINE("File found.");
  1349.    TEMP := HEAD;
  1350.    while not END_OF_FILE(INPUT_FILE) loop
  1351.       GET_LINE(INPUT_FILE, INPUT.VAL, INPUT.LEN);      -- Read a line.
  1352.       TEMP.NEXT := new LINK'(LINE_NUM, INPUT, null);   -- Add to list.
  1353.       TEMP := TEMP.NEXT;              -- Advance pointer to next link.
  1354.       LINE_NUM := LINE_NUM + 10;
  1355.    end loop;
  1356.    CLOSE(INPUT_FILE);
  1357. exception  -- If the input file doesn't exist, just display a message.
  1358.    when NAME_ERROR => PUT_LINE("File not found.");
  1359. end READ_INPUT_FILE;
  1360.  
  1361. separate (LEDIT)
  1362. procedure DO_COMMAND is
  1363.    procedure DELETE_FIRST_CHARACTER(T : in out TEXT) is separate;
  1364.    procedure GET_LEADING_INTEGER(N : out NATURAL) is separate;
  1365.    procedure STRIP_LEADING_SPACES_FROM_INPUT is separate;
  1366.    procedure ADD_DELETE_REPLACE_LINE is separate;
  1367.    procedure LIST is separate;
  1368. begin
  1369.    STRIP_LEADING_SPACES_FROM_INPUT;
  1370.    if STR(INPUT) = "exit" or STR(INPUT) = "EXIT" then
  1371.       FINISHED := TRUE;
  1372.    elsif INPUT.LEN >= 4 and (INPUT.VAL(1 .. 4) = "list" or
  1373.                                INPUT.VAL(1 .. 4) = "LIST") then
  1374.       LIST;
  1375.    elsif INPUT.LEN > 0 and INPUT.VAL(1) not in '0' .. '9' then
  1376.       PUT_LINE("Unrecognized command.");
  1377.    elsif INPUT.LEN > 0 then
  1378.       GET_LEADING_INTEGER(LINE_NUM);
  1379.       if LINE_NUM not in 1 .. MAX_LINE_NUMBER then
  1380.          PUT_LINE("Illegal line number.");
  1381.       else
  1382.          ADD_DELETE_REPLACE_LINE;
  1383.       end if;
  1384.    end if;
  1385. exception
  1386.    when NUMERIC_ERROR | CONSTRAINT_ERROR =>
  1387.       PUT_LINE("Line number too large.");
  1388. end DO_COMMAND;
  1389.  
  1390.  
  1391.                            -- continued --
  1392.  
  1393.                                                                Page 31
  1394.  
  1395. separate (LEDIT.DO_COMMAND)
  1396. procedure ADD_DELETE_REPLACE_LINE is
  1397.    INP : TEXT := INPUT;
  1398. begin
  1399.    if INP.LEN > 0 and INP.VAL(1) = ' ' then  -- Treat "9x" like "9 x".
  1400.       DELETE_FIRST_CHARACTER(INP);
  1401.    end if;
  1402.    TEMP := HEAD;     -- Find where this number belongs in linked list.
  1403.    while TEMP /= null and then TEMP.NEXT /= null and then
  1404.                                TEMP.NEXT.NUM <= LINE_NUM loop
  1405.       if TEMP.NEXT.NUM = LINE_NUM then
  1406.          TEMP.NEXT := TEMP.NEXT.NEXT;                  -- Delete line.
  1407.       else
  1408.          TEMP := TEMP.NEXT;           -- Advance to next link in list.
  1409.       end if;
  1410.    end loop;
  1411.    if INPUT.LEN > 0 then                                  -- Add line.
  1412.       TEMP.NEXT := new LINK'(LINE_NUM, INP, TEMP.NEXT);
  1413.    end if;
  1414. end ADD_DELETE_REPLACE_LINE;
  1415.  
  1416. separate (LEDIT.DO_COMMAND)
  1417. procedure DELETE_FIRST_CHARACTER(T : in out TEXT) is
  1418. begin
  1419.    T.VAL(1 .. T.LEN - 1) := T.VAL(2 .. T.LEN);
  1420.    T.LEN := T.LEN - 1;
  1421. end DELETE_FIRST_CHARACTER;
  1422.  
  1423. separate (LEDIT.DO_COMMAND)
  1424. procedure GET_LEADING_INTEGER(N : out NATURAL) is
  1425.    ANS: INTEGER := 0;
  1426. begin
  1427.    while INPUT.LEN > 0 and INPUT.VAL(1) in '0' .. '9' loop
  1428.       ANS := ANS*10 + CHARACTER'POS(INPUT.VAL(1)) -CHARACTER'POS('0');
  1429.       DELETE_FIRST_CHARACTER(INPUT);
  1430.    end loop;
  1431.    N := ANS;
  1432. end GET_LEADING_INTEGER;
  1433.  
  1434. separate (LEDIT.DO_COMMAND)
  1435. procedure STRIP_LEADING_SPACES_FROM_INPUT is
  1436. begin
  1437.    while INPUT.LEN > 0 and INPUT.VAL(1) = ' ' loop
  1438.       DELETE_FIRST_CHARACTER(INPUT);
  1439.    end loop;
  1440. end STRIP_LEADING_SPACES_FROM_INPUT;
  1441.  
  1442.  
  1443.                            -- continued --
  1444.  
  1445.                                                                Page 32
  1446.  
  1447. separate (LEDIT.DO_COMMAND)
  1448. procedure LIST is
  1449.    package IIO is new INTEGER_IO(INTEGER); use IIO;
  1450.    START, FINISH : NATURAL;
  1451.    VALID         : BOOLEAN := TRUE;
  1452. begin
  1453.    INPUT.LEN := INPUT.LEN - 4;      -- Delete the name of the command.
  1454.    INPUT.VAL(1 .. INPUT.LEN) := INPUT.VAL(5 .. INPUT.LEN + 4);
  1455.    STRIP_LEADING_SPACES_FROM_INPUT;
  1456.    if INPUT.LEN = 0 then          -- For "LIST" alone, list all lines.
  1457.       START := 0;
  1458.       FINISH := MAX_LINE_NUMBER + 1;
  1459.    else
  1460.       GET_LEADING_INTEGER(START);          -- Get number after "LIST".
  1461.       STRIP_LEADING_SPACES_FROM_INPUT;
  1462.       if INPUT.LEN = 0 then         -- For "LIST n", list only line n.
  1463.          FINISH := START;
  1464.       elsif INPUT.VAL(1) /= '-' then        -- Else "-" must follow n.
  1465.          VALID := FALSE;
  1466.       else
  1467.          DELETE_FIRST_CHARACTER(INPUT);             -- Delete the "-".
  1468.          STRIP_LEADING_SPACES_FROM_INPUT;
  1469.          GET_LEADING_INTEGER(FINISH);         -- Get number after "-".
  1470.          STRIP_LEADING_SPACES_FROM_INPUT;
  1471.          if FINISH = 0 and START = 0 then     -- "LIST -" isn't valid.
  1472.             VALID := FALSE;
  1473.          elsif FINISH = 0 then  -- For "LIST n -", list n through end.
  1474.             FINISH := MAX_LINE_NUMBER + 1;
  1475.          end if;
  1476.          VALID := VALID  and  INPUT.LEN = 0;   -- No trailing garbage.
  1477.       end if;
  1478.    end if;
  1479.    if not VALID then
  1480.       PUT_LINE("Illegal syntax for LIST.");
  1481.    else
  1482.       TEMP := HEAD.NEXT;  -- Skip unused link at start of linked list.
  1483.       while TEMP /= null and then TEMP.NUM <= FINISH loop
  1484.          if TEMP.NUM >= START then
  1485.             PUT(TEMP.NUM, WIDTH => 5);     -- Display line #, width 5.
  1486.             PUT_LINE(' ' & STR(TEMP.LINE));   -- Display text of line.
  1487.          end if;
  1488.          TEMP := TEMP.NEXT;                          -- Get next link.
  1489.       end loop;
  1490.    end if;
  1491. exception
  1492.    when NUMERIC_ERROR | CONSTRAINT_ERROR =>
  1493.       PUT_LINE("Line number too large in LIST.");
  1494. end LIST;
  1495.  
  1496.                                                                Page 33
  1497.  
  1498. TASKING.DUM
  1499. -----------
  1500.  
  1501. with text_io, calendar; use text_io, calendar;
  1502. procedure tasking is
  1503.    interval        : constant duration := 5.0;
  1504.    total_intervals : constant positive := 9;
  1505.    start_time      : constant time := clock;
  1506.    quitting_time   : constant time := start_time +
  1507.                                              total_intervals*interval;
  1508.    next_time       : time := start_time;
  1509.    task type tick is
  1510.       entry make_noise;
  1511.       entry shutdown;
  1512.    end tick;
  1513.    t               : tick;
  1514.    task body tick is
  1515.       quit : boolean := false;
  1516.    begin
  1517.       while not quit loop
  1518.          select
  1519.             accept make_noise do
  1520.                put_line("Tick!");
  1521.             end make_noise;
  1522.          or
  1523.             accept shutdown;
  1524.             quit := true;
  1525.          end select;
  1526.       end loop;
  1527.    end tick;
  1528. begin
  1529.    while next_time < quitting_time loop
  1530.       t.make_noise;
  1531.       next_time := next_time + interval;
  1532.       put_line("(5-second delay)"); delay next_time - clock;
  1533.    end loop;
  1534.    t.shutdown;
  1535. end tasking;
  1536.  
  1537.                                                                Page 34
  1538.  
  1539.          STEPS FOR OUTSIDE ASSIGNMENT 6, EXERCISE IN TASKING
  1540.  
  1541. 1.  Make a copy of TASKING.DUM by typing COPY TASKING.DUM TASKING.ADA.
  1542.     Compile, link, and execute the program to make sure it displays
  1543.     "Tick!" nine times, with a 5-second delay after each "Tick."
  1544.  
  1545. 2.  Edit TASKING.ADA to become your solution.  Make your changes in
  1546.     upper case.
  1547.  
  1548. 3.  Compile TASKING.ADA, link, and execute.
  1549.  
  1550. 4.  Compare your output with page 35 of these notes.  If there are any
  1551.     errors, go back to step 2.
  1552.  
  1553. 5.  When your output agrees with these notes, you've finished the
  1554.     assignment and will have a chance to compare your solution with
  1555.     ours.
  1556.  
  1557.                                                                Page 35
  1558.  
  1559.       OUTPUT FROM TASKING.EXE AFTER MODIFICATION OF TASKING.ADA
  1560.  
  1561. C>tasking
  1562. Task number 1 is starting.
  1563. Task number 2 is starting.
  1564. Task number 3 is starting.
  1565. (5-second delay)
  1566. (5-second delay)
  1567. Task number 1 is starting.
  1568. (5-second delay)
  1569. Task number 2 is starting.
  1570. (5-second delay)
  1571. Task number 1 is starting.
  1572. Task number 3 is starting.
  1573. (5-second delay)
  1574. (5-second delay)
  1575. Task number 1 is starting.
  1576. Task number 2 is starting.
  1577. (5-second delay)
  1578. (5-second delay)
  1579. Task number 1 is starting.
  1580. Task number 3 is starting.
  1581. (5-second delay)
  1582.  
  1583. C>
  1584.  
  1585.                                                                Page 36
  1586.  
  1587. TASKING.ANS
  1588. -----------
  1589.  
  1590. -- Our solution to Outside Assignment 6:
  1591. with text_io, calendar; use text_io, calendar;
  1592. procedure tasking is
  1593.    interval        : constant duration := 5.0;
  1594.    total_intervals : constant positive := 9;
  1595.    start_time      : constant time := clock;
  1596.    quitting_time   : constant time := start_time +
  1597.                                              total_intervals*interval;
  1598.    next_time       : time := start_time;
  1599.    task type tick is
  1600.       ENTRY IDENTIFY(TASK_NUMBER : IN NATURAL);
  1601.       entry shutdown;
  1602.    end tick;
  1603.    T               : ARRAY(1 .. 3) OF TICK;
  1604.    PERIOD          : CONSTANT ARRAY(T'RANGE) OF POSITIVE := (2, 3, 4);
  1605.    TIMER           : ARRAY(T'RANGE) OF NATURAL := (OTHERS => 0);
  1606.    task body tick is
  1607.       quit : boolean := false;
  1608.    begin
  1609.       while not quit loop
  1610.          select
  1611.             ACCEPT IDENTIFY(TASK_NUMBER : IN NATURAL) DO
  1612.                PUT_LINE("Task number" & INTEGER'IMAGE(TASK_NUMBER) &
  1613.                     " is starting.");
  1614.             END IDENTIFY;
  1615.          or
  1616.             accept shutdown;
  1617.             quit := true;
  1618.          end select;
  1619.       end loop;
  1620.    end tick;
  1621. begin
  1622.    while next_time < quitting_time loop
  1623.       FOR I IN T'RANGE LOOP
  1624.          IF TIMER(I) = 0 THEN
  1625.             T(I).IDENTIFY(I);
  1626.             TIMER(I) := PERIOD(I);
  1627.          END IF;
  1628.          TIMER(I) := TIMER(I) - 1;
  1629.       END LOOP;
  1630.       next_time := next_time + interval;
  1631.       put_line("(5-second delay)"); delay next_time - clock;
  1632.    end loop;
  1633.    FOR I IN T'RANGE LOOP
  1634.       T(I).SHUTDOWN;
  1635.    END LOOP;
  1636. end tasking;
  1637.  
  1638.                                                                Page 37
  1639.  
  1640.   APPENDIX A:  WOULD YOU LIKE A TEXTBOOK TO USE ALONG WITH ADA-TUTR?
  1641.  
  1642. ADA-TUTR doesn't require a textbook, but a number of users have asked
  1643. us to recommend a book that would go well with this course.  We made a
  1644. special arrangement with John Wiley and Sons so that you can buy the
  1645. excellent textbook RENDEZVOUS WITH ADA by David Naiditch for only
  1646. $42.95 plus sales tax.  Simply print the file COUPON.TXT, or copy the
  1647. coupon below.  Please send it to the address on the coupon, not to
  1648. Software Innovations Technology.
  1649.  
  1650. +--------------------------------------------------------------------+
  1651. |                                                                    |
  1652. | If you would like to have a textbook to go along with ADA-TUTR,    |
  1653. | send this coupon to                                                |
  1654. |                                                                    |
  1655. |                   Attn.: Diane Dooley, 4th floor                   |
  1656. |                       Wiley - Training Sales                       |
  1657. |                        John Wiley and Sons                         |
  1658. |                          605 Third Avenue                          |
  1659. |                        New York, NY  10158                         |
  1660. |                                                                    |
  1661. | Please send me ______ copy(ies) of RENDEZVOUS WITH ADA by David    |
  1662. | Naiditch, to examine for 15 days.                                  |
  1663. |                                                                    |
  1664. | Order #: 1-61654-0.  Price: $42.95 plus local sales tax, postage   |
  1665. | and handling.                                                      |
  1666. |                                                                    |
  1667. | [ ]  Bill me.                                                      |
  1668. |                                                                    |
  1669. | [ ]  Payment enclosed.  (Orders accompanied by payment will be     |
  1670. |      sent postpaid.)                                               |
  1671. |                                                                    |
  1672. | [ ]  Charge my   ___ VISA   ___ MasterCard   ___ American Express  |
  1673. |      (Note: Credit card orders are not considered prepayment.)     |
  1674. |                                                                    |
  1675. |      Account #: ________________________________                   |
  1676. |                                                                    |
  1677. |      Expiration Date: __________________________                   |
  1678. |                                                                    |
  1679. | NAME:____________________________ AFFILIATION:____________________ |
  1680. |                                                                    |
  1681. | ADDRESS:__________________________________________________________ |
  1682. |                                                                    |
  1683. | CITY/STATE/ZIP:_____________________ SIGNATURE:___________________ |
  1684. |                                  (Offer invalid without signature) |
  1685. |                                                                    |
  1686. | (Prices subject to change without notice and higher outside the    |
  1687. | U.S.A.)                                                            |
  1688. |                                                                    |
  1689. +--------------------------------------------------------------------+
  1690.  
  1691.                                                                Page 38
  1692.  
  1693.           APPENDIX B:  RUNNING BOOK TO PRINT ALL THE SCREENS
  1694.  
  1695. If you're running ADA-TUTR on a PC, you can always print the screen
  1696. that's currently being displayed by holding a Shift key while pressing
  1697. the PrtSc key.
  1698.  
  1699. However, several users wanted to be able to print ALL the screens in
  1700. the entire course, as one large book.  So, starting with version 2.0
  1701. of ADA-TUTR, we added the program BOOK.  This program reads the file
  1702. ADA_TUTR.DAT and produces two large output files, which can then be
  1703. printed.  Be prepared to print almost 500 pages!
  1704.  
  1705. Simply type BOOK to run the program.  BOOK first asks you if you'll be
  1706. using PC-Write to print the files.  (See page 42 for information about
  1707. PC-Write.)
  1708.  
  1709. If you answer Y, BOOK will put PC-Write "boldface" commands in the
  1710. output files.  Thus the text will print in boldface wherever you see
  1711. emphasized text on the screen.
  1712.  
  1713.  
  1714. However, if you answer N, BOOK will create plain ASCII files, double
  1715.                                                               ------
  1716. spaced the way this paragraph is double spaced.  It will emphasize
  1717. ------                           -------------           ---------
  1718. text by placing hyphens below the lines like this.
  1719.                 -------                 ---------
  1720.  
  1721. Next, BOOK will ask you for the name of the output file for the first
  1722. half of the tutorial.  After that file is written, BOOK will ask for
  1723. the name of the output file for the second half of the tutorial.  You
  1724. can then print the output files.
  1725.  
  1726. If you're not using PC-Write, you can optionally specify the name PRN
  1727. for both output files, and the output of BOOK will go directly to the
  1728. printer.
  1729.  
  1730. Begin reading your printed output with Screen 104.  Note that, at the
  1731. bottom of each page, there's a list of possible user responses with
  1732. screen numbers.  For example, at the bottom of Screen 104 you will see
  1733.  
  1734.   'Y' 107  'N' 120
  1735.  
  1736. This means that, if the user presses Y, he will next see Screen 107,
  1737. and if the user presses N, he will next see Screen 120.  Pressing X
  1738. always takes the user to Screen 103.  The special "screen numbers" 098
  1739. through 100 appearing at the bottom of Screens 107 and 108 are
  1740. explained in the introductory comments in ADA_TUTR.ADA.
  1741.  
  1742. BOOK, like ADA-TUTR, will run on a PC or on any Ada-speaking computer.
  1743.  
  1744.                                                                Page 39
  1745.  
  1746.          APPENDIX C:  SOME ADA COMPILERS AVAILABLE FOR THE PC
  1747.  
  1748. Here's a brief list of Ada compilers available for the IBM PC and
  1749. compatibles.  For this course, an Ada compiler is helpful, but not
  1750. required.  There are six Outside Assignments; most of them ask you to
  1751. write and compile a short Ada program.  If you don't have access to an
  1752. Ada compiler, just skip the Outside Assignments.
  1753.  
  1754. Although we may now have a small financial interest in some of the
  1755. companies mentioned here (see page 5), we try to keep this list
  1756. unbiased.  If you know of an Ada compiler for the PC that should be on
  1757. this list, or if you have any updated information or corrections,
  1758. please contact us.
  1759.  
  1760. 1.  At the low end of the scale is Augusta.  This compiler is in the
  1761.     public domain, and can be found on many computer bulletin boards.
  1762.     It's a very small subset of Ada with no packages.  It translates
  1763.     Ada to a P-code, and then interprets the P-code.  Some of the
  1764.     syntax is non-standard, such as "elseif" where Ada uses "elsif."
  1765.     Older versions of Augusta require Turbo Pascal.  Augusta isn't
  1766.     really adequate for most of the Outside Assignments of ADA-TUTR.
  1767.  
  1768. 2.  Janus/Ada is sold by R R Software, Inc., Box 1512, Madison, WI
  1769.     53701, phone 800-722-3248, starting at $129.  Educational
  1770.     discounts are available.  A complete development system with tools
  1771.     (such as a debugger) and utility packages is available for $500,
  1772.     but it requires an 80386 computer.  Janus/Ada is validated and
  1773.     produces native PC code; no interpreter is required.
  1774.  
  1775. 3.  Open Ada is sold by Meridian Software Systems, Inc., 10 Pasteur
  1776.     St., Irvine, CA 92718, phone 800-221-2522 (in CA, 714-727-0700),
  1777.     for $199 ($99 for students).  Open Ada includes tools (such as a
  1778.     debugger) and utility packages.  It's validated and produces
  1779.     native PC code; no interpreter is required.
  1780.  
  1781. 4.  IntegrAda is sold by Aetech, Inc., 5841 Edison Place, Suite 110,
  1782.     Carlsbad, CA 92008, phone 619-431-7714, for $395.  Students can
  1783.     obtain the IntegrAda Student Package, which includes IntegrAda and
  1784.     learning tools, for $149.  IntegrAda includes CASE (Computer-Aided
  1785.     Software Engineering) tools and utility packages.  It's validated
  1786.     and produces native PC code; no interpreter is required.
  1787.  
  1788. 5.  At the high end of the scale is FirstAda, sold by Alsys, Inc., 67
  1789.     South Bedford St., Burlington, MA 01803-9748, phone 617-270-0030.
  1790.     The price is $595.  FirstAda is validated and requires a PC/AT (or
  1791.     compatible) with at least 2 MB of extended memory.  However, it
  1792.     can produce native code for the PC/XT; no interpreter is required.
  1793.  
  1794.                                                                Page 40
  1795.  
  1796.             APPENDIX D:  SAMPLE MULTI-USER SOFTWARE LICENSE
  1797.  
  1798. Software Innovations Technology believes in a plain-English software
  1799. license that people can understand.  A sample license appears on the
  1800. next page.  However, if your company's lawyers would prefer a
  1801. differently worded license, simply contact us.  We'll be happy to
  1802. accommodate you.
  1803.  
  1804. As you can see, the terms of our license are very generous.  We allow
  1805. you to make as many copies of ADA-TUTR as you like, and to install it
  1806. on as many computers as you like, regardless of the computer type
  1807. (laptop, desktop, workstation, mainframe, etc.)  Also, you may use
  1808. ADA-TUTR at all your geographical locations, which is why we use the
  1809. term Multi-User License rather than Site License.  The only thing we
  1810. limit is the total number of people who may use ADA-TUTR (except in
  1811. the case of an unlimited license).  Please remember that if 100 people
  1812. use ADA-TUTR now and 100 others use it later, that counts as 200
  1813. users, not 100.
  1814.  
  1815. In the sample license on the next page, comments appear in brackets.
  1816. These comments are not part of the actual license.
  1817.  
  1818.                                                                Page 41
  1819.  
  1820.                  [SAMPLE] MULTI-USER SOFTWARE LICENSE
  1821.  
  1822.                     Software Innovations Technology
  1823.                         1083 Mandarin Drive NE
  1824.                        Palm Bay, FL  32905-4706
  1825.                             (407) 951-0233
  1826.  
  1827.  
  1828.    This license conveys to XYZ Company the right to use the comput-
  1829.    er program  ADA-TUTR, the Interactive Ada Tutor,  under the fol-
  1830.    lowing conditions:
  1831.  
  1832.    1.  The program shall remain  the property of  Software  Innova-
  1833.    tions Technology.
  1834.  
  1835.    2.  The program may be freely copied and installed on any or all
  1836.    computers of  XYZ Company,  regardless of geographical location.
  1837.    Copies of the program may be distributed outside XYZ Company for
  1838.    others to evaluate on a trial basis.
  1839.  
  1840.    3.  This license is perpetual.
  1841.  
  1842.    4.  The number of  XYZ Company  personnel [or "students and per-
  1843.    sonnel of XYZ University"] who may use the program is unlimited.
  1844.                              [*** OR ***]
  1845.    4.  The total number of XYZ Company personnel  [or "students and
  1846.    personnel of  XYZ  University"]  who use the program,  excluding
  1847.    those who only briefly evaluate it, shall not exceed  two  thou-
  1848.    sand (2000)  [or "five hundred (500)"  or  "one hundred (100)"].
  1849.    In calculating the number of users,  XYZ Company must always add
  1850.    the number of people  currently  using the program to the number
  1851.    who have used it in the past.
  1852.  
  1853.    5.  [This paragraph is omitted in unlimited licenses.]  Software
  1854.    Innovations Technology  sells  licenses  for  larger  numbers of
  1855.    users.  XYZ Company may, at any time, upgrade this license for a
  1856.    larger number of users by paying,  to Software Innovations Tech-
  1857.    nology, the difference in price between the two licenses.
  1858.  
  1859.    6.  This license is not transferable.
  1860.  
  1861.    7.  The Disclaimer of Warranty, included in the program documen-
  1862.    tation, applies as if included in this license.
  1863.  
  1864.    8.  [This paragraph is  omitted  if the order is prepaid.]  This
  1865.    license shall be  void  if the invoice is not paid within thirty
  1866.    (30) days of the date of this license.
  1867.  
  1868.  
  1869.    (Signed)________________________________  Date _________________
  1870.  
  1871.            John J. Herro, President
  1872.            Software Innovations Technology
  1873.  
  1874.                                                                Page 42
  1875.  
  1876.       APPENDIX E:  DO YOU NEED A SCREEN EDITOR / WORD PROCESSOR?
  1877.  
  1878. The Outside Assignments will be much easier if you have a good screen
  1879. editor.  We've looked at many, and found PC-Write Advanced Level, a
  1880. Shareware program by Quicksoft of Seattle, WA to be the best screen
  1881. editor as well as word processor.  There's lots of on-line help, and
  1882. the 50000-word spelling checker can be turned on for editing letters
  1883. and documents, and off for editing source code.  We liked the idea of
  1884. having to learn only ONE program for both kinds of editing!  Unlike
  1885. ADA-TUTR, PC-Write Advanced Level runs only on PCs and compatibles,
  1886. not on mainframes, etc.
  1887.  
  1888. We have no connection with Quicksoft, except for being a registered
  1889. user of PC-Write Advanced Level.  However, we'll be happy to send you
  1890. a free copy of the latest version of that excellent program, if you
  1891. send us four blank, formatted, 360K 5.25" diskettes or two 720K 3.5"
  1892. diskettes, and a stamped, addressed diskette mailer.  Or send us $20
  1893. for four 5.25" diskettes or two 3.5" diskettes.  The diskettes or fee
  1894. covers only our expenses; you must register your copy of PC-Write with
  1895. Quicksoft if you use it after a free trial.  We're sorry, but we're
  1896. allowed to send copies of PC-Write only to the U.S., Canada, the
  1897. United Kingdom, Australia, and New Zealand.
  1898.  
  1899. If you use PC-Write Advanced Level to edit Ada programs, you may find
  1900. the file ED.ADA, included with ADA-TUTR, to be helpful.  It allows
  1901. typing many Ada reserved words with a single keystroke.  For example,
  1902. you can type "procedure" by striking Ctrl-P.  See the file ED.ADA for
  1903. more details.  PC-Write Advanced Level will automatically invoke
  1904. ED.ADA whenever you edit a file with the extension .ADA.
  1905.  
  1906.                                                                Page 43
  1907.  
  1908.          APPENDIX F:  INSTALLING ADA-TUTR ON OTHER COMPUTERS
  1909.  
  1910. Because source code is included with ADA-TUTR, you can install
  1911. ADA-TUTR on almost any computer that has an Ada compiler - from
  1912. compact units to large mainframes.  ADA-TUTR is written in Ada (of
  1913. course!), and Ada programs tend to be very portable.
  1914.  
  1915. The screen should have at least 24 rows of 80 characters each, and
  1916. should support the ANSI escape sequences for highlighting, reverse
  1917. video, cursor positioning, etc.  Almost all computers qualify.
  1918.  
  1919. You need a way to send text files from your PC to the other computer.
  1920. Files are usually sent to large mainframes with the program KERMIT,
  1921. which is in the public domain.  One version of KERMIT runs on the PC,
  1922. another on the mainframe.  The two communicate with each other.
  1923. Sometimes XMODEM or another protocol is used instead of KERMIT.
  1924.  
  1925. If a communications program is available on the PC but not on the
  1926. other computer, you can still send text files, but not as efficiently.
  1927. Connect your PC as a terminal and tell the other computer to copy the
  1928. keyboard to a new file.  For example, on a VAX computer running VMS,
  1929. the command is "COPY TT: filename.ext" (without the quotes).  Then
  1930. tell your communications program to send (or "upload") the file, using
  1931. ASCII protocol, and stripping line feeds.  After the file is sent,
  1932. type the appropriate end-of-file character for the other computer.  On
  1933. a VAX running VMS, you would type Control-Z.  Since this method of
  1934. file transfer doesn't do error checking, you may have to send each
  1935. file twice using two different names, and compare the two files with
  1936. each other on the other computer.  It's far better to use a
  1937. communications program on the other computer, if one is available.
  1938.  
  1939. OK, you have some means of sending text files.  You won't have to send
  1940. other kinds of files.  To install ADA-TUTR on the other computer, just
  1941. follow these steps:
  1942.  
  1943. 1.  Type DAT2TXT on the PC.  This will read the file ADA_TUTR.DAT,
  1944. which is not a text file, and create a new text file TUTOR.TXT, which
  1945. can be sent to the other computer.  DAT2TXT will probably take several
  1946. minutes to run.  Don't try to bypass this step even if you're able to
  1947. send non-text files.  It's important that you send TUTOR.TXT and not
  1948. ADA_TUTR.DAT, because the PC version of ADA_TUTR.DAT doesn't work on
  1949. some systems.
  1950.  
  1951. 2.  Decide where ADA-TUTR will reside on the other computer, so that
  1952. it will be available to all users.  For example, on a VAX computer
  1953. running VMS, the tutor is usually placed in SYS$INSTRUCTION.  It could
  1954. also be placed in SYS$MANAGER, etc.
  1955.  
  1956.                            -- continued --
  1957.  
  1958.                                                                Page 44
  1959.  
  1960. 3.  Send to the other computer all the files that come with ADA-TUTR,
  1961. except ADA_TUTR.DAT and the files ending in .EXE.  Be sure to send
  1962. TUTOR.TXT, created in step 1.  Don't try to send ADA_TUTR.DAT and the
  1963. .EXE files, because they're not text files.  Also note that ADA-TUTR
  1964. creates a file ADA_TUTR.USR the first time it's run.  Do NOT send that
  1965. file, because it also is not a text file.  If our file names are
  1966. illegal on the other system, you'll have to rename them as they're
  1967. sent.  (We haven't seen a system where our file names are illegal.)
  1968.  
  1969. 4.  If any of the file names ADA_TUTR.DAT, ADA_TUTR.USR, or TUTOR.TXT
  1970. are illegal on your system, edit the files ADA_TUTR.ADA, BOOK.ADA,
  1971. CHANGESN.ADA, and TXT2DAT.ADA to show new, legal file names.  Search
  1972. for the old file names and replace them with the new ones.
  1973.  
  1974. 5.  Note that each user will probably run ADA-TUTR from his own file
  1975. directory.  There will be a file ADA_TUTR.USR in each user's
  1976. directory, but all the other files will reside in a common area, such
  1977. as SYS$INSTRUCTION, etc.  Therefore, edit the files ADA_TUTR.ADA,
  1978. BOOK.ADA, CHANGESN.ADA, and TXT2DAT.ADA to show the full path name of
  1979. the file ADA_TUTR.DAT.  On a VAX system, for example, you might search
  1980. for the name ADA_TUTR.DAT and replace it with
  1981. SYS$INSTRUCTION:ADA_TUTR.DAT.
  1982.  
  1983. 6.  On one system we encountered, Ada source file names must end in .a
  1984. rather than .ADA.  If that's the case on your system, rename all the
  1985. .ADA files.
  1986.  
  1987. 7.  On the other computer, compile, link, and run TXT2DAT.ADA.  Some
  1988. systems call the linking step "binding."  This program will read
  1989. TUTOR.TXT and create ADA_TUTR.DAT on the other system.  If you wish,
  1990. you may then delete TUTOR.TXT.
  1991.  
  1992. 8.  If you're using VAX Ada, skip to page 46.  If you're using a UNIX
  1993. based system that has a C compiler with the ability to link into Ada
  1994. programs, skip to page 47.  Otherwise, continue with the next page.
  1995. If you're not certain, continue with the next page.
  1996.  
  1997.                            -- continued --
  1998.  
  1999.                                                                Page 45
  2000.  
  2001.  
  2002. 9.  Compile VANILLA.ADA, but don't try to link or run it.  This "plain
  2003. vanilla" file will work with any standard Ada compiler.
  2004.  
  2005. 10.  Compile ADA_TUTR.ADA.
  2006.  
  2007. 11.  Link, giving the name of the main program, ADA_TUTR.  This will
  2008. produce an executable file, which on most systems will be called
  2009. ADA_TUTR.EXE.  However, on a few systems the executable file will have
  2010. a strange name, so rename the executable file if necessary.
  2011.  
  2012. 12.  Run ADA-TUTR.  The command is usually ADA_TUTR or RUN ADA_TUTR.
  2013. Note that, on some systems, you'll have to strike ENTER (or RETURN or
  2014. NEW-LINE) after each response, even though the program says, "You need
  2015. not hit ENTER."  The reason is that some systems require you to strike
  2016. ENTER when they read the keyboard through TEXT_IO.  However, with
  2017. recent versions of TeleGen Ada, you don't have to hit ENTER.  Also
  2018. note that some of the tutorial text refers to commands that are meant
  2019. for a PC, such as COPY and PRINT.  These commands may have to be
  2020. varied slightly to work on your system.
  2021.  
  2022. 13.  Define a command so that each user will be able to run ADA-TUTR
  2023. easily.
  2024.  
  2025.  
  2026. We'll be happy to help you install ADA-TUTR and get it running, even
  2027. if you haven't registered or bought a license.  We want you to try
  2028. ADA-TUTR before paying for it.
  2029.  
  2030.                                                                Page 46
  2031.  
  2032.                    SPECIAL INSTRUCTIONS FOR VAX ADA
  2033.  
  2034. 9.  If you're using VAX Ada, compile VAX.ADA, but don't try to link or
  2035. run it.  The file VANILLA.ADA would work, but VAX.ADA makes it
  2036. unnecessary to strike RETURN after each response.  The reason is that
  2037. VAX.ADA gets characters from the keyboard by calling the System
  2038. Service routines, without going through TEXT_IO.
  2039.  
  2040. 10.  Compile ADA_TUTR.ADA.
  2041.  
  2042. 11.  Link, giving the name of the main program, ADA_TUTR.  The command
  2043. is ACS LINK ADA_TUTR.  This will produce an executable file,
  2044. ADA_TUTR.EXE.
  2045.  
  2046. 12.  Run ADA-TUTR by typing RUN ADA_TUTR.  Note that some of the
  2047. tutorial text refers to commands that are meant for a PC, such as COPY
  2048. and PRINT.  These commands may have to be varied slightly to work on
  2049. your system.  For example, when the text says to type
  2050. COPY TRITYPE.DUM TRITYPE.ADA, your users might have to type
  2051. COPY SYS$INSTRUCTION:TRITYPE.DUM TRITYPE.ADA.
  2052.  
  2053. 13.  Define a command so that each user will be able to run ADA-TUTR
  2054. easily.  For example, you might add the following line to SYLOGIN.COM:
  2055.  
  2056.             $ TEACHADA :== "RUN SYS$INSTRUCTION:ADA_TUTR"
  2057.  
  2058.  
  2059. We'll be happy to help you install ADA-TUTR and get it running, even
  2060. if you haven't registered or bought a license.  We want you to try
  2061. ADA-TUTR before paying for it.
  2062.  
  2063.                                                                Page 47
  2064.  
  2065.              SPECIAL INSTRUCTIONS FOR UNIX BASED SYSTEMS
  2066.  
  2067. 9.  If you're using a UNIX based system with a C compiler, and your
  2068. Ada compiler can link with modules produced by C, compile ONECHAR.C
  2069. with the C compiler.  If you can't compile ONECHAR.C because your
  2070. system doesn't have the include file TERMIO.H, then compile ALTCHAR.C
  2071. instead.  However, if you compile ALTCHAR.C, you'll have to invoke
  2072. ADA-TUTR between two calls to stty, in a script file.  For example:
  2073.                      stty raw
  2074.                      /usr/local/ada-tutr/ada_tutr
  2075.                      stty -raw
  2076.  
  2077. 10.  Compile UNIX.ADA, but don't try to link or run it.  The file
  2078. VANILLA.ADA would work, but UNIX.ADA, when used with ONECHAR.C or
  2079. ALTCHAR.C, makes it unnecessary to strike RETURN after each response.
  2080. The reason is that ONECHAR.C and ALTCHAR.C get characters directly
  2081. from the keyboard, without going through TEXT_IO.
  2082.  
  2083. 11.  Compile ADA_TUTR.ADA.
  2084.  
  2085. 12.  Link, giving the name of the main program, ADA_TUTR.  Include the
  2086. object file from the C compiler in the link.  This will create an
  2087. executable file, called ADA_TUTR on most systems.  (On one system we
  2088. encountered, the file created was named a.out.)  If necessary, rename
  2089. the executable file to an appropriate name, such as ada_tutr or
  2090. ADA_TUTR or ADA_TUTR.EXE.
  2091.  
  2092.  
  2093. Here are sample steps 9 through 12 for two UNIX based systems:
  2094.  
  2095.        ON A UNISYS 5000/80:             ON A HARRIS HCX:
  2096.  
  2097.        cc -c onechar.c                  cc -c onechar.c
  2098.        ada unix.ada ada_tutr.ada        ada unix.a ada_tutr.a
  2099.        ald -p'onechar' ada_tutr         a.ld ada_tutr onechar.o
  2100.                                         mv a.out ada_tutr
  2101.  
  2102.  
  2103. 13.  Run ADA-TUTR.  Usually this is done by typing ada_tutr.  Note
  2104. that some of the tutorial text refers to commands that are meant for a
  2105. PC, such as COPY and PRINT.  These commands may have to be varied
  2106. slightly to work on your system.
  2107.  
  2108. 14.  Define a command so that each user will be able to run ADA-TUTR
  2109. easily.
  2110.  
  2111.  
  2112. We'll be happy to help you install ADA-TUTR and get it running, even
  2113. if you haven't registered or bought a license.  We want you to try
  2114. ADA-TUTR before paying for it.
  2115.  
  2116.                                                                Page 48
  2117.  
  2118.           APPENDIX G:  WE LISTEN!  NEW FEATURES OF ADA-TUTR
  2119.  
  2120. Almost all of the features added to ADA-TUTR were done as a result of
  2121. your comments and suggestions.  Thank you very much, and please
  2122. continue to send them!  We want to produce the very best Ada Tutor
  2123. possible.  Here's a history of revisions to ADA-TUTR.  In addition to
  2124. the changes shown here, we're constantly making minor improvements in
  2125. the tutorial text and updating the list of Ada compilers available for
  2126. the PC (page 39).
  2127.  
  2128.  
  2129. VERSION 2.02:
  2130.  
  2131. Added the files DESC.SDI and FILE_ID.DIZ, briefly describing ADA-TUTR.
  2132.  
  2133. Improved ED.ADA to take advantage of the newest version PC-Write,
  2134. called PC-Write Advanced Level.
  2135.  
  2136.  
  2137. VERSION 2.01:
  2138.  
  2139. Added the file JANUS.ADA.
  2140.  
  2141.  
  2142. VERSION 2.00:
  2143.  
  2144. Changed the ADA_TUTR.DAT file to a more compact format, so that
  2145. ADA-TUTR would take less room on a hard disk and be able to run from a
  2146. floppy diskette.
  2147.  
  2148. Added the BOOK program to print all of the tutorial screens as a large
  2149. book (page 38).
  2150.  
  2151. Updated Outside Assignment 6 to make it easier to see where the
  2152. 5-second intervals occur.
  2153.  
  2154. Updated the list of Ada compilers available for the PC (page 39).
  2155.  
  2156. Added the sample Multi-User License (pages 40-41).
  2157.  
  2158. Added the special offer for a textbook (page 37).
  2159.  
  2160.  
  2161. VERSION 1.22:
  2162.  
  2163. Added ALTCHAR.C for UNIX based systems that don't have the file
  2164. TERMIO.H.  (Thank you, Mr. Richard Conn, 2700 Bowline Court,
  2165. Maineville, OH 45039.)
  2166.  
  2167.                                                                Page 49
  2168.  
  2169. VERSION 1.21:
  2170.  
  2171. Added ONECHAR.C so users of UNIX based systems wouldn't have to strike
  2172. ENTER after each response.  (Thank you, Mr. David Hill, 7549 Wynford
  2173. Street, Salt Lake City, UT 84121.)
  2174.  
  2175. Changed all hyphens in file names to underlines, at the request of
  2176. PC-SIG, so that ADA-TUTR would be compatible with High Sierra Format
  2177. CD-ROMs.
  2178.  
  2179.  
  2180. VERSION 1.20:
  2181.  
  2182. Added the ability to select background, foreground, and border colors
  2183. on a PC without sacrificing compatibility with mainframe computers and
  2184. monochrome PCs.
  2185.  
  2186. Made ADA-TUTR automatically remember where you leave off when you exit
  2187. the program, so that you don't have to write down the screen number.
  2188. Also made ADA-TUTR remember your color choices.
  2189.  
  2190. Made ADA-TUTR tell you the current screen number and the approximate
  2191. percentage through the course when you strike X, and added the ability
  2192. to go back to the last question or to the last Outside Assignment.
  2193.  
  2194. Added a special screen at the start of each major section, showing an
  2195. outline of the course.
  2196.  
  2197. Updated the tutorial text to reflect the government's new policy
  2198. regarding expiration of Validation Certificates.
  2199.  
  2200. Updated the tutorial text to show that the newest Ada compilers now
  2201. raise CONSTRAINT_ERROR where NUMERIC_ERROR was once raised.
  2202.  
  2203. Added the offer for customized versions of ADA-TUTR, and for the
  2204. Customization Kit (page 4).
  2205.  
  2206. Recompiled ADA-TUTR using a validated compiler from Meridian Software
  2207. Systems, Inc., instead of an older unvalidated compiler from Artek,
  2208. Inc.
  2209.  
  2210. Made ADA-TUTR available on 3.5" as well as 5.25" diskettes.
  2211.  
  2212.  
  2213. VERSION 1.01:
  2214.  
  2215. Fixed minor typographical errors in Version 1.00.
  2216.  
  2217.                                                                Page 50
  2218.  
  2219.                  APPENDIX H:  DISCLAIMER OF WARRANTY
  2220.  
  2221. We hate legal mumbo jumbo, but we have to say the following to protect
  2222. ourselves:
  2223.  
  2224. Software Innovations Technology makes no warranty of any kind,
  2225. expressed or implied, including any warranties of merchantability or
  2226. fitness for a particular purpose.  We shall not be liable for any
  2227. damages, whether direct, indirect, incidental, special, or
  2228. consequential, arising from a failure of this program to operate in a
  2229. manner desired by the user.  We shall not be liable for any damage to
  2230. data or property which may be caused directly or indirectly by use of
  2231. this program.  IN NO EVENT SHALL SOFTWARE INNOVATIONS TECHNOLOGY BE
  2232. LIABLE FOR ANY DAMAGES, INCLUDING ANY LOST PROFITS, LOST SAVINGS, OR
  2233. OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
  2234. INABILITY TO USE THIS PROGRAM, OR FOR ANY CLAIM BY ANY OTHER PARTY.
  2235.